Fix kayobe overcloud provision without seed in limit
If you run 'kayobe overcloud provision' for the first time on a system, and do not include the seed in the limit (e.g. --limit overcloud), then the following error is seen: Destination directory /etc/kolla/bifrost/inventory/host_vars does not exist This is because the first play in ansible/kolla-bifrost-hostvars.yml executes against the seed. This is not ideal, as the --limit argment is useful with this command, as a way to provision specific nodes. This change fixes the issue by moving the initialisation tasks to the second play which is targeted at the overcloud group. The run_once parameter ensures it happens once. Change-Id: I7dff72a50f0592a3564c9d84d684db562c30626a Story: 2006757 Task: 37247
This commit is contained in:
parent
a02c65832c
commit
e0ff12eaef
@ -1,34 +1,17 @@
|
|||||||
---
|
---
|
||||||
# Update the Bifrost inventory with the IP allocation and other variables.
|
# 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
|
- name: Ensure the Bifrost overcloud inventory is populated
|
||||||
hosts: overcloud
|
hosts: overcloud
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
tags:
|
tags:
|
||||||
- kolla-bifrost-hostvars
|
- kolla-bifrost-hostvars
|
||||||
|
become: true
|
||||||
vars:
|
vars:
|
||||||
seed_host: "{{ groups['seed'][0] }}"
|
seed_host: "{{ groups['seed'][0] }}"
|
||||||
|
# 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) }}"
|
||||||
bifrost_hostvars:
|
bifrost_hostvars:
|
||||||
addressing_mode: static
|
addressing_mode: static
|
||||||
ipv4_interface_mac: "{% raw %}{{ extra.pxe_interface_mac | default }}{% endraw %}"
|
ipv4_interface_mac: "{% raw %}{{ extra.pxe_interface_mac | default }}{% endraw %}"
|
||||||
@ -42,6 +25,22 @@
|
|||||||
network_mtu: "{{ admin_oc_net_name | net_mtu or '1500' }}"
|
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) }}"
|
vlan_id: "{{ '' if admin_oc_net_name == provision_oc_net_name else (admin_oc_net_name | net_vlan) }}"
|
||||||
tasks:
|
tasks:
|
||||||
|
- block:
|
||||||
|
- name: Ensure the Bifrost host variables directory exists
|
||||||
|
file:
|
||||||
|
path: "/etc/kolla/bifrost/inventory/host_vars"
|
||||||
|
state: directory
|
||||||
|
run_once: 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
|
||||||
|
run_once: true
|
||||||
|
|
||||||
- name: Ensure the Bifrost host variable files exist
|
- name: Ensure the Bifrost host variable files exist
|
||||||
copy:
|
copy:
|
||||||
content: |
|
content: |
|
||||||
@ -51,8 +50,3 @@
|
|||||||
{{ bifrost_hostvars | to_nice_yaml }}
|
{{ bifrost_hostvars | to_nice_yaml }}
|
||||||
dest: "/etc/kolla/bifrost/inventory/host_vars/{{ inventory_hostname }}"
|
dest: "/etc/kolla/bifrost/inventory/host_vars/{{ inventory_hostname }}"
|
||||||
delegate_to: "{{ seed_host }}"
|
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
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user