From 6d118054ec13a3723f7540208dba56debc716879 Mon Sep 17 00:00:00 2001
From: Markos Chandras <mchandras@suse.de>
Date: Tue, 19 Sep 2017 11:36:23 +0100
Subject: xci: provision-vm-nodes.yml: Merge plays

There is no need to have multiple plays executed on a single host group
so merge them all together into a single one.

Change-Id: Ie190cdecfbdcba48f75b21aa5930e1d9b8392aa0
Signed-off-by: Markos Chandras <mchandras@suse.de>
---
 xci/playbooks/provision-vm-nodes.yml | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/xci/playbooks/provision-vm-nodes.yml b/xci/playbooks/provision-vm-nodes.yml
index 81fc5755..fd8c31d2 100644
--- a/xci/playbooks/provision-vm-nodes.yml
+++ b/xci/playbooks/provision-vm-nodes.yml
@@ -29,11 +29,6 @@
     - { role: clone-repository, project: "opnfv/releng-xci", repo: "{{ OPNFV_RELENG_GIT_URL }}", dest: "{{ OPNFV_RELENG_PATH }}", version: "{{ OPNFV_RELENG_VERSION }}" }
     - { role: clone-repository, project: "opnfv/bifrost", repo: "{{ OPENSTACK_BIFROST_GIT_URL }}", dest: "{{ OPENSTACK_BIFROST_PATH }}", version: "{{ OPENSTACK_BIFROST_VERSION }}" }
 
-- hosts: localhost
-  connection: local
-  gather_facts: true
-  vars_files:
-    - ../var/opnfv.yml
   tasks:
     - name: Load distribution variables
       include_vars:
@@ -64,16 +59,6 @@
         - "{{ OPENSTACK_BIFROST_PATH }}/playbooks/inventory"
       when:
         - XCI_EXTRA_VARS_PATH != ""
-
-- hosts: localhost
-  connection: local
-  gather_facts: true
-  vars_files:
-    - ../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/"
@@ -81,13 +66,15 @@
 
 - hosts: localhost
   connection: local
-  become: yes
+  become: true
+  gather_facts: true
   vars_files:
     - ../var/opnfv.yml
   tasks:
     - name: Load distribution variables
       include_vars:
         file: ../var/{{ ansible_os_family }}.yml
+
     - name: destroy VM nodes created by previous deployment
       command: "/bin/bash ./scripts/destroy-env.sh"
       args:
-- 
cgit 


From 669e79ad41b59ec3901642cf0533e71ae412d589 Mon Sep 17 00:00:00 2001
From: Markos Chandras <mchandras@suse.de>
Date: Tue, 19 Sep 2017 17:04:55 +0100
Subject: xci: Move the destroy-env.sh script to xci-deploy.sh

There is no particular need to execute the bash script using Ansible.
Lets move it to the xci-deploy.sh script instead.

Change-Id: I0fa91195d9c3647bb4766d76c28892e2f13e1e98
Signed-off-by: Markos Chandras <mchandras@suse.de>
---
 xci/playbooks/provision-vm-nodes.yml | 16 ----------------
 xci/xci-deploy.sh                    |  2 ++
 2 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/xci/playbooks/provision-vm-nodes.yml b/xci/playbooks/provision-vm-nodes.yml
index fd8c31d2..b9c13999 100644
--- a/xci/playbooks/provision-vm-nodes.yml
+++ b/xci/playbooks/provision-vm-nodes.yml
@@ -63,19 +63,3 @@
       copy:
         src: "{{ OPNFV_RELENG_PATH }}/bifrost/"
         dest: "{{ OPENSTACK_BIFROST_PATH }}"
-
-- hosts: localhost
-  connection: local
-  become: true
-  gather_facts: true
-  vars_files:
-    - ../var/opnfv.yml
-  tasks:
-    - name: Load distribution variables
-      include_vars:
-        file: ../var/{{ ansible_os_family }}.yml
-
-    - name: destroy VM nodes created by previous deployment
-      command: "/bin/bash ./scripts/destroy-env.sh"
-      args:
-        chdir: "{{ OPENSTACK_BIFROST_PATH }}"
diff --git a/xci/xci-deploy.sh b/xci/xci-deploy.sh
index 19f2c18a..78194fbe 100755
--- a/xci/xci-deploy.sh
+++ b/xci/xci-deploy.sh
@@ -114,6 +114,8 @@ fi
 #-------------------------------------------------------------------------------
 echo "Info: Starting provisining VM nodes using openstack/bifrost"
 echo "-------------------------------------------------------------------------"
+cd $XCI_PATH/../bifrost/
+sudo -E bash ./scripts/destroy-env.sh
 cd $XCI_PATH/playbooks
 # NOTE(hwoarang) we need newer ansible to work on the following playbook
 sudo pip uninstall -y ansible || true
-- 
cgit