kayobe/ansible/ip-allocation.yml
Maksim Malchuk 1de4f2a4a3 Skip IP address allocation and configuration if needed
Sometimes some hosts should be configured with an interface without any
IP address set (e.g. bridged interface) and to achieve that this change
adds the new attribute 'no_ip' for the network configuration. Also the
change contain a test for this.

Change-Id: I2c9dfeca7f0d37a96f9cbd9df51d94098cf07258
Signed-off-by: Maksim Malchuk <maksim.malchuk@gmail.com>
2022-03-18 11:39:40 +01:00

35 lines
1.1 KiB
YAML

---
- name: Ensure IP addresses are allocated
hosts: seed-hypervisor:seed:overcloud:infra-vms
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 }}"