group_vars: Refactor provisioner/bifrost
This change refactors bifrost provisioner playbooks and
roles to use group_vars instead of using vars from
engine/engine/var directory.
As bifrost/provision.sh is run on localhost initially,
it uses the newly created inventory file, localhost.ini,
to enable the use of group_vars. In the last command of
bifrost/provision.sh, bifrost_inventory.py is copied to
engine/engine/inventory to access to group_vars so the
the new full inventory file, inventory.ini, to use during
stack installation can be generated.
See the first change in series for the reasoning of
switching to group_vars which has additional information
as well.
Change-Id: I0cc76c2d2e1fb3b192e395c64f5df476b68a9200
diff --git a/playbooks/roles/generate-inventory/tasks/generate-kolla-inventory.yml b/playbooks/roles/generate-inventory/tasks/generate-kolla-inventory.yml
index 05c96fc..697e3c7 100644
--- a/playbooks/roles/generate-inventory/tasks/generate-kolla-inventory.yml
+++ b/playbooks/roles/generate-inventory/tasks/generate-kolla-inventory.yml
@@ -17,9 +17,16 @@
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
+# TODO - group_vars: needed for backward compatibility - remove this once the transition is done
- name: Generate Kolla inventory from PDF and IDF
template:
src: "inventory_kolla_{{ openstack_version }}.ini.j2"
dest: "{{ config_path }}/inventory.ini"
+# TODO - group_vars: update the task name once the transition is done
+- name: Generate Kolla inventory from PDF and IDF (new)
+ template:
+ src: "inventory_kolla_{{ openstack_version }}.ini.j2"
+ dest: "{{ inventory_path }}/inventory.ini"
+
# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/generate-inventory/tasks/generate-kubespray-inventory.yml b/playbooks/roles/generate-inventory/tasks/generate-kubespray-inventory.yml
index 5738a87..becf73c 100644
--- a/playbooks/roles/generate-inventory/tasks/generate-kubespray-inventory.yml
+++ b/playbooks/roles/generate-inventory/tasks/generate-kubespray-inventory.yml
@@ -17,9 +17,16 @@
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
+# TODO - group_vars: needed for backward compatibility - remove this once the transition is done
- name: Generate Kubespray inventory from PDF and IDF
template:
src: inventory_kubespray.ini.j2
dest: "{{ config_path }}/inventory.ini"
+# TODO - group_vars: update the task name once the transition is done
+- name: Generate Kubespray inventory from PDF and IDF (new)
+ template:
+ src: inventory_kubespray.ini.j2
+ dest: "{{ inventory_path }}/inventory.ini"
+
# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/generate-inventory/tasks/main.yml b/playbooks/roles/generate-inventory/tasks/main.yml
index 75a5efe..122b1ec 100644
--- a/playbooks/roles/generate-inventory/tasks/main.yml
+++ b/playbooks/roles/generate-inventory/tasks/main.yml
@@ -25,3 +25,10 @@
- include: generate-kolla-inventory.yml
when: installer_type == 'kolla'
+# we are done with bifrost_inventory.py so we can remove it
+- name: Delete bifrost_inventory.py
+ file:
+ path: "{{ inventory_path }}/bifrost_inventory.py"
+ state: absent
+
+# vim: set ts=2 sw=2 expandtab: