kayobe/ansible/dell-compute-node-inventory.yml
Mark Goddard 6c54ce4d3b Introduce max fail percentage to playbooks
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
2024-06-03 16:24:29 +00:00

48 lines
1.8 KiB
YAML

---
- name: Ensure Dell baremetal compute nodes are present in the Ansible inventory
hosts: localhost
gather_facts: no
vars:
# Set this to a colon-separated list of baremeal compute node hostnames on
# which to trigger discovery. If unset, all compute nodes will be
# triggered.
compute_node_limit: ""
compute_node_limit_list: "{{ compute_node_limit.split(':') }}"
tasks:
- name: Add hosts for the Dell baremetal compute nodes
add_host:
name: "{{ item.key }}"
groups: baremetal-compute
# SSH configuration to access the BMC.
ansible_host: "{{ item.value }}"
ansible_user: "{{ ipmi_username }}"
ansible_ssh_pass: "{{ ipmi_password }}"
with_dict: "{{ idrac_network_ips }}"
# Don't add hosts that already exist.
when:
- item.key not in groups['all']
- item.key | replace('-idrac', '') not in groups['all']
- not compute_node_limit or item.key | replace('-idrac', '') in compute_node_limit_list
run_once: True
- name: Ensure Dell baremetal compute nodes are present in the Ansible inventory
hosts: baremetal-compute
gather_facts: no
max_fail_percentage: >-
{{ dell_compute_node_inventory_fail_percentage |
default(baremetal_compute_max_fail_percentage) |
default(kayobe_max_fail_percentage) |
default(100) }}
vars:
compute_node_limit: ""
compute_node_limit_list: "{{ compute_node_limit.split(':') }}"
tasks:
- name: Set facts for the compute nodes for IPMI addresses
set_fact:
bmc_type: idrac
ipmi_address: "{{ idrac_network_ips[inventory_hostname] }}"
when:
- not ipmi_address
- not compute_node_limit or inventory_hostname in compute_node_limit_list
run_once: True