kayobe/ansible/kolla-bifrost-hostvars.yml
Will Szumski 3fca0d00a9 Adds a separate admin network
The admin network is intended for remote admin access to
the overcloud hosts e.g SSH. If admin_oc_net_name is not set
it will default to provision_oc_net_name for backwards
compatability.

Story: 2002096
Task: 19774

Change-Id: Ib04bbc07f97218d7503000cc363624c60c287822
2018-06-25 14:21:51 +00:00

59 lines
2.3 KiB
YAML

---
# Update the Bifrost inventory with the IP allocation and other variables.
- name: Ensure the Bifrost overcloud inventory is initialised
hosts: seed
gather_facts: no
tags:
- kolla-bifrost-hostvars
tasks:
- name: Ensure the Bifrost host variables directory exists
file:
path: "/etc/kolla/bifrost/inventory/host_vars"
state: directory
become: True
- name: Ensure the Bifrost inventory exists
file:
path: "/etc/kolla/bifrost/inventory/bifrost_inventory.py"
src: "/bifrost/playbooks/inventory/bifrost_inventory.py"
state: link
# This file should only exist within the bifrost_deploy container.
force: True
become: True
- name: Ensure the Bifrost overcloud inventory is populated
hosts: overcloud
gather_facts: no
tags:
- kolla-bifrost-hostvars
vars:
seed_host: "{{ groups['seed'][0] }}"
bifrost_hostvars:
addressing_mode: static
ipv4_interface_mac: "{% raw %}{{ extra.pxe_interface_mac | default }}{% endraw %}"
ipv4_address: "{{ admin_oc_net_name | net_ip }}"
ipv4_subnet_mask: "{{ admin_oc_net_name | net_cidr | ipaddr('netmask') }}"
# If the admin network does not have a gateway defined, use the
# seed as a gateway to allow external access until other networks have
# been configured.
ipv4_gateway: "{{ admin_oc_net_name | net_gateway or admin_oc_net_name | net_ip(seed_host) }}"
ipv4_nameserver: "{{ resolv_nameservers }}"
network_mtu: "{{ admin_oc_net_name | net_mtu or '1500' }}"
vlan_id: "{{ '' if admin_oc_net_name == provision_oc_net_name else (admin_oc_net_name | net_vlan) }}"
tasks:
- name: Ensure the Bifrost host variable files exist
copy:
content: |
---
# This file is managed via Ansible. Do not edit.
# Bifrost host variables for {{ inventory_hostname }}
{{ bifrost_hostvars | to_nice_yaml }}
dest: "/etc/kolla/bifrost/inventory/host_vars/{{ inventory_hostname }}"
delegate_to: "{{ seed_host }}"
vars:
# NOTE: Without this, the seed's ansible_host variable will not be
# respected when using delegate_to.
ansible_host: "{{ hostvars[seed_host].ansible_host | default(seed_host) }}"
become: True