kayobe/ansible/ip-allocation.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

40 lines
1.2 KiB
YAML

---
- name: Ensure IP addresses are allocated
hosts: seed-hypervisor:seed:overcloud:infra-vms
max_fail_percentage: >-
{{ ip_allocation_max_fail_percentage |
default(host_configure_max_fail_percentage) |
default(kayobe_max_fail_percentage) |
default(100) }}
tags:
- ip-allocation
gather_facts: no
# Use serial=1 to avoid races between allocations for different hosts.
serial: 1
pre_tasks:
- name: Initialise the IP allocations fact
set_fact:
ip_allocations: []
- name: Update the IP allocations fact with IP allocation requests
set_fact:
ip_allocations: >
{{
ip_allocations +
[{
'net_name': item,
'cidr': item|net_cidr,
'allocation_pool_start': item|net_allocation_pool_start,
'allocation_pool_end': item|net_allocation_pool_end
}]
}}
with_items: "{{ network_interfaces }}"
when:
- item | net_cidr != None
- item | net_bootproto != 'dhcp'
- not item | net_no_ip | bool
roles:
- role: ip-allocation
ip_allocation_filename: "{{ kayobe_env_config_path }}/network-allocation.yml"
ip_allocation_hostname: "{{ inventory_hostname }}"