6c54ce4d3b
This allows us to continue execution until a certain proportion of hosts fail. This can be useful at scale, where failures are common, and restarting a deployment is time-consuming. The default max failure percentage is 100, keeping the default behaviour. A global max failure percentage may be set via kayobe_max_fail_percentage, and individual playbooks may define a max failure percentage via <playbook>_max_fail_percentage. Related Kolla Ansible patch: https://review.opendev.org/c/openstack/kolla-ansible/+/805598 Change-Id: Ib81c72b63be5765cca664c38141ffc769640cf07
47 lines
1.5 KiB
YAML
47 lines
1.5 KiB
YAML
---
|
|
# Variables:
|
|
# - dump_path: Path to directory to store variable dumps (optional)
|
|
# - dump_facts: Whether to include gathered facts in the dump (optional)
|
|
# - dump_hosts: Group/host specifier for hosts to dump (optional)
|
|
# - dump_var_name: Name of the option to dump (optional)
|
|
|
|
- name: Dump configuration from one or more hosts
|
|
hosts: "{{ dump_hosts }}"
|
|
gather_facts: "{{ dump_facts }}"
|
|
max_fail_percentage: >-
|
|
{{ dump_config_max_fail_percentage |
|
|
default(kayobe_max_fail_percentage) |
|
|
default(100) }}
|
|
tags:
|
|
- dump-config
|
|
vars:
|
|
dump_path: /tmp/kayobe-dump-config
|
|
dump_facts: no
|
|
dump_hosts: all
|
|
tasks:
|
|
- name: Create configuration dump directory
|
|
local_action:
|
|
module: file
|
|
path: "{{ dump_path }}"
|
|
state: directory
|
|
|
|
- name: Write host config to file
|
|
local_action:
|
|
module: copy
|
|
content: "{{ hostvars[inventory_hostname] | to_nice_yaml }}"
|
|
dest: "{{ dump_path }}/{{ inventory_hostname }}.yml"
|
|
when: dump_var_name is not defined
|
|
|
|
- name: Write host variable to file
|
|
local_action:
|
|
module: copy
|
|
content: "{{ hostvars[inventory_hostname][dump_var_name] | to_nice_yaml }}"
|
|
dest: "{{ dump_path }}/{{ inventory_hostname }}.yml"
|
|
when: dump_var_name is defined
|
|
|
|
# - name: Write merged config to file
|
|
# local_action:
|
|
# module: copy
|
|
# content: "{{ hostvars | merge_config | to_nice_yaml }}"
|
|
# dest: "{{ dump_path }}/merged.yml
|