kayobe/ansible/ip-allocation.yml
Will Szumski c583922c27 Add support for infrastructure VMs
This change allows you to define additional VMs to deploy
on the seed-hypervisor.

Co-authored-by: Piotr Parczewski <piotr@stackhpc.com>
Co-authored-by: Will Szumski <will@stackhpc.com>
Co-authored-by: Mark Goddard <mark@stackhpc.com>
Story: 2008741
Task: 42095
Change-Id: I8055fc5eb0a9edadcb35767303c659922f2d07ca
2021-10-04 12:40:54 +01:00

34 lines
1.0 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'
roles:
- role: ip-allocation
ip_allocation_filename: "{{ kayobe_env_config_path }}/network-allocation.yml"
ip_allocation_hostname: "{{ inventory_hostname }}"