xci: playbooks: Add task for loading distribution variables 83/41783/19
authorMarkos Chandras <mchandras@suse.de>
Fri, 15 Sep 2017 15:28:42 +0000 (16:28 +0100)
committerMarkos Chandras <mchandras@suse.de>
Fri, 15 Sep 2017 20:39:35 +0000 (21:39 +0100)
vars_files doesn't support loading files with variables in their names.
As such we add a new task to include these files before running any of
the roles. This fixes warnings like this:

Info: Starting provisining VM nodes using openstack/bifrost
-------------------------------------------------------------------------
No config file found; using defaults
skipping vars_file '../var/{{ ansible_os_family }}.yml' due to an undefined variable
skipping vars_file '../var/{{ ansible_os_family }}.yml' due to an undefined variable
skipping vars_file '../var/{{ ansible_os_family }}.yml' due to an undefined variable
skipping vars_file '../var/{{ ansible_os_family }}.yml' due to an undefined variable
skipping vars_file '../var/{{ ansible_os_family }}.yml' due to an undefined variable
skipping vars_file '../var/{{ ansible_os_family }}.yml' due to an undefined variable

Change-Id: I0a49e2ed8d811bb40a99612462752f8691133e0f
Signed-off-by: Markos Chandras <mchandras@suse.de>
xci/playbooks/configure-localhost.yml
xci/playbooks/configure-opnfvhost.yml
xci/playbooks/configure-targethosts.yml
xci/playbooks/provision-vm-nodes.yml

index 2dfa053..10dd694 100644 (file)
 - hosts: localhost
   connection: local
   vars_files:
-    - ../var/{{ ansible_os_family }}.yml
     - ../var/opnfv.yml
+  pre_tasks:
+    - name: Load distribution variables
+      include_vars:
+        file: ../var/{{ ansible_os_family }}.yml
   roles:
     - role: remove-folders
     - { role: clone-repository, project: "opnfv/releng-xci", repo: "{{ OPNFV_RELENG_GIT_URL }}", dest: "{{ OPNFV_RELENG_PATH }}", version: "{{ OPNFV_RELENG_VERSION }}" }
   connection: local
   gather_facts: false
   vars_files:
-    - ../var/{{ ansible_os_family }}.yml
     - ../var/opnfv.yml
   tasks:
+    - name: Load distribution variables
+      include_vars:
+        file: ../var/{{ ansible_os_family }}.yml
     - name: Synchronize local development releng-xci repository to XCI paths
       synchronize:
         src: "{{ OPNFV_RELENG_DEV_PATH }}"
 - hosts: localhost
   connection: local
   vars_files:
-    - ../var/{{ ansible_os_family }}.yml
     - ../var/opnfv.yml
   tasks:
+    - name: Load distribution variables
+      include_vars:
+        file: ../var/{{ ansible_os_family }}.yml
     - name:  create log directory {{LOG_PATH}}
       file:
         path: "{{LOG_PATH}}"
   connection: local
   gather_facts: false
   vars_files:
-    - ../var/{{ ansible_os_family }}.yml
     - ../var/opnfv.yml
   tasks:
+    - name: Load distribution variables
+      include_vars:
+        file: ../var/{{ ansible_os_family }}.yml
     - name: create certificate directory /etc/ssl/certs
       file:
         path: "/etc/ssl/certs"
index 5beddcd..da47825 100644 (file)
 - hosts: opnfv
   remote_user: root
   vars_files:
-    - ../var/{{ ansible_os_family }}.yml
     - ../var/flavor-vars.yml
     - ../var/opnfv.yml
+  pre_tasks:
+    - name: Load distribution variables
+      include_vars:
+        file: ../var/{{ ansible_os_family }}.yml
   roles:
     - role: remove-folders
     - { role: clone-repository, project: "opnfv/releng-xci", repo: "{{ OPNFV_RELENG_GIT_URL }}", dest: "{{ OPNFV_RELENG_PATH }}", version: "{{ OPNFV_RELENG_VERSION }}" }
 - hosts: opnfv
   remote_user: root
   vars_files:
-    - ../var/{{ ansible_os_family }}.yml
     - ../var/opnfv.yml
   tasks:
+    - name: Load distribution variables
+      include_vars:
+        file: ../var/{{ ansible_os_family }}.yml
     - name: Synchronize local development releng-xci repository to XCI paths
       synchronize:
         src: "{{ OPNFV_RELENG_DEV_PATH }}"
 - hosts: opnfv
   remote_user: root
   vars_files:
-    - ../var/{{ ansible_os_family }}.yml
     - ../var/flavor-vars.yml
     - ../var/opnfv.yml
+  pre_tasks:
+    - name: Load distribution variables
+      include_vars:
+        file: ../var/{{ ansible_os_family }}.yml
   roles:
       - role: configure-network
   tasks:
   gather_facts: no
   remote_user: root
   vars_files:
-    - ../var/{{ ansible_os_family }}.yml
     - ../var/flavor-vars.yml
     - ../var/opnfv.yml
     - "{{ XCI_FLAVOR_ANSIBLE_FILE_PATH }}/user_variables.yml"
+  pre_tasks:
+    - name: Load distribution variables
+      include_vars:
+        file: ../var/{{ ansible_os_family }}.yml
   roles:
     - role: "openstack-ansible-openstack_openrc"
   tasks:
index 88da131..0b3bf34 100644 (file)
 - hosts: controller
   remote_user: root
   vars_files:
-    - ../var/{{ ansible_os_family }}.yml
     - ../var/flavor-vars.yml
+  pre_tasks:
+    - name: Load distribution variables
+      include_vars:
+        file: ../var/{{ ansible_os_family }}.yml
   roles:
     - role: configure-network
     # we need to force sync time with ntp or the nodes will be out of sync timewise
 - hosts: compute
   remote_user: root
   vars_files:
-    - ../var/{{ ansible_os_family }}.yml
     - ../var/flavor-vars.yml
+  pre_tasks:
+    - name: Load distribution variables
+      include_vars:
+        file: ../var/{{ ansible_os_family }}.yml
   roles:
     - role: configure-network
     # we need to force sync time with ntp or the nodes will be out of sync timewise
index e9b8fa2..5e897e1 100644 (file)
@@ -9,9 +9,13 @@
 ##############################################################################
 - hosts: localhost
   connection: local
+  gather_facts: true
   vars_files:
-    - ../var/{{ ansible_os_family }}.yml
     - ../var/opnfv.yml
+  pre_tasks:
+    - name: Load distribution variables
+      include_vars:
+        file: ../var/{{ ansible_os_family }}.yml
   roles:
     # using these roles here ensures that we can reuse this playbook in different context
     - role: remove-folders
 
 - hosts: localhost
   connection: local
-  gather_facts: false
+  gather_facts: true
   vars_files:
-    - ../var/{{ ansible_os_family }}.yml
     - ../var/opnfv.yml
   tasks:
+    - name: Load distribution variables
+      include_vars:
+        file: ../var/{{ ansible_os_family }}.yml
     - name: Synchronize local development bifrost repository to XCI paths
       # command module is much faster than the copy module
       synchronize:
 
 - hosts: localhost
   connection: local
-  gather_facts: false
+  gather_facts: true
   vars_files:
-    - ../var/{{ ansible_os_family }}.yml
     - ../var/opnfv.yml
   tasks:
+    - name: Load distribution variables
+      include_vars:
+        file: ../var/{{ ansible_os_family }}.yml
     - name: combine opnfv/releng-xci and openstack/bifrost scripts/playbooks
       copy:
         src: "{{ OPNFV_RELENG_PATH }}/bifrost/"