a91135179d
Currently we install python dependencies on the Ansible control host each time the ip-allocation and console-allocation roles are executed. This is inefficient, particularly in the case of the ip-allocation role which is run serially for all hosts. It is also unnecessary since we have these packages available in the Python environment used to execute kayobe. The kolla-ansible role also has an implicit dependency on PyYAML for managing kolla passwords. This change uses ansible_playbook_python as the Python interpreter for the necessary tasks in these roles to avoid installing dependencies on the system on CentOS 8 and Ubuntu. For CentOS 7 we still need to use the platform Python, due to needing SELinux bindings. Change-Id: Ic6a1c69a34241f4fbe617a0b12aec9b1528ba352 Story: 2006574 Task: 38825
51 lines
1.5 KiB
YAML
51 lines
1.5 KiB
YAML
---
|
|
# NOTE(mgoddard): We use delegate_to rather than specify localhost in the
|
|
# hosts list since this playbook is typically called with a limit that does
|
|
# not include localhost. This play may be removed when CentOS 7 is no longer
|
|
# supported.
|
|
- name: Gather facts for localhost
|
|
hosts: seed-hypervisor:seed:overcloud
|
|
tags:
|
|
- ip-allocation
|
|
gather_facts: no
|
|
tasks:
|
|
- name: Gather facts for localhost
|
|
setup:
|
|
gather_subset: min
|
|
delegate_to: localhost
|
|
delegate_facts: true
|
|
run_once: true
|
|
|
|
- name: Ensure IP addresses are allocated
|
|
hosts: seed-hypervisor:seed:overcloud
|
|
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_config_path }}/network-allocation.yml"
|
|
ip_allocation_hostname: "{{ inventory_hostname }}"
|