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:
diff --git a/playbooks/roles/get-baremetal-info/tasks/main.yml b/playbooks/roles/get-baremetal-info/tasks/main.yml
index aca6313..7301ba3 100644
--- a/playbooks/roles/get-baremetal-info/tasks/main.yml
+++ b/playbooks/roles/get-baremetal-info/tasks/main.yml
@@ -54,3 +54,5 @@
   when:
     - interface.macaddress == node.interfaces[idf.net_config.neutron.interface].mac_address
     - "'.' not in interface.device"
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/install-configure-bifrost/tasks/create-bifrost-inventory-entry.yml b/playbooks/roles/install-configure-bifrost/tasks/create-bifrost-inventory-entry.yml
index eb906d1..35ed13d 100644
--- a/playbooks/roles/install-configure-bifrost/tasks/create-bifrost-inventory-entry.yml
+++ b/playbooks/roles/install-configure-bifrost/tasks/create-bifrost-inventory-entry.yml
@@ -16,6 +16,7 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END=========================================================
+
 - name: Find node in PDF by node name '{{ host.key }}'
   set_fact:
     hostname: "{{ host.value }}"
@@ -49,3 +50,5 @@
 - name: Add node data of '{{ hostname }}' to bifrost inventory
   set_fact:
     bifrost_inventory: "{{ bifrost_inventory | combine({hostname: node_data}) }}"
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/install-configure-bifrost/tasks/create-bifrost-inventory-file.yml b/playbooks/roles/install-configure-bifrost/tasks/create-bifrost-inventory-file.yml
index 95d8016..fff4302 100644
--- a/playbooks/roles/install-configure-bifrost/tasks/create-bifrost-inventory-file.yml
+++ b/playbooks/roles/install-configure-bifrost/tasks/create-bifrost-inventory-file.yml
@@ -16,6 +16,7 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END=========================================================
+
 - name: Remove previous bifrost inventory {{ bifrost_inventory_source }}
   file:
     state: absent
diff --git a/playbooks/roles/install-configure-bifrost/tasks/create-bifrost-playbooks.yml b/playbooks/roles/install-configure-bifrost/tasks/create-bifrost-playbooks.yml
index 21e6e94..8ecfea5 100644
--- a/playbooks/roles/install-configure-bifrost/tasks/create-bifrost-playbooks.yml
+++ b/playbooks/roles/install-configure-bifrost/tasks/create-bifrost-playbooks.yml
@@ -16,6 +16,7 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END=========================================================
+
 - name: Load distribution variables
   include_vars:
     file: "{{ distro }}.yml"
diff --git a/playbooks/roles/install-configure-bifrost/tasks/download-image.yml b/playbooks/roles/install-configure-bifrost/tasks/download-image.yml
index c42f4e2..95f8729 100644
--- a/playbooks/roles/install-configure-bifrost/tasks/download-image.yml
+++ b/playbooks/roles/install-configure-bifrost/tasks/download-image.yml
@@ -16,6 +16,7 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END=========================================================
+
 - name: Set download source and destination for the deployment image
   set_fact:
     source: "{{ item.source }}"
@@ -42,3 +43,5 @@
       sha256sum: "{{ header.x_checksum_sha256 }}"
   when: download_image
   become: yes
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/install-configure-bifrost/tasks/main.yml b/playbooks/roles/install-configure-bifrost/tasks/main.yml
index 1befc88..8379e6b 100644
--- a/playbooks/roles/install-configure-bifrost/tasks/main.yml
+++ b/playbooks/roles/install-configure-bifrost/tasks/main.yml
@@ -16,6 +16,7 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END=========================================================
+
 - include_tasks: cleanup-bifrost.yml
 
 - name: Clone bifrost repository and checkout '{{ bifrost_version }}'
diff --git a/playbooks/roles/prepare-libvirt/tasks/main.yml b/playbooks/roles/prepare-libvirt/tasks/main.yml
index 4978b44..8edba81 100644
--- a/playbooks/roles/prepare-libvirt/tasks/main.yml
+++ b/playbooks/roles/prepare-libvirt/tasks/main.yml
@@ -16,6 +16,7 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END=========================================================
+
 - name: "Load distribution defaults"
   include_vars: "{{ ansible_os_family | lower }}.yml"