diff options
author | 2017-09-22 14:06:10 +0000 | |
---|---|---|
committer | 2017-09-22 14:06:10 +0000 | |
commit | 08fbdfaadb1cfba8ba46d1970d784bfbabc7e212 (patch) | |
tree | c77fbff6cb8ff484cdce2e22b8012bac6727e458 | |
parent | 639ac5a794f961fb2a8db3cb3fb19681de26ab3c (diff) | |
parent | 3a281e5c91bf05d94361af1ff5818657d92a1bfd (diff) |
Merge changes from topic 'split-variable-creation-to-task'
* changes:
xci: playbooks: Include distribution var files dynamically
bifrost: scripts: Look for virtualbmc on bifrost virtualenv
xci: Gain elevated privileges to remove the XCI_DEVEL_ROOT directory
xci: Move VM provisioning to xci-deploy.sh
-rwxr-xr-x | bifrost/scripts/bifrost-provision.sh | 2 | ||||
-rwxr-xr-x | bifrost/scripts/destroy-env.sh | 17 | ||||
-rw-r--r-- | xci/file/aio/configure-opnfvhost.yml | 8 | ||||
-rw-r--r-- | xci/playbooks/configure-localhost.yml | 13 | ||||
-rw-r--r-- | xci/playbooks/configure-opnfvhost.yml | 13 | ||||
-rw-r--r-- | xci/playbooks/provision-vm-nodes.yml | 15 | ||||
-rwxr-xr-x | xci/xci-deploy.sh | 9 |
7 files changed, 54 insertions, 23 deletions
diff --git a/bifrost/scripts/bifrost-provision.sh b/bifrost/scripts/bifrost-provision.sh index df05c7ce..d4d1f96a 100755 --- a/bifrost/scripts/bifrost-provision.sh +++ b/bifrost/scripts/bifrost-provision.sh @@ -16,7 +16,7 @@ BIFROST_HOME=$SCRIPT_HOME/.. ANSIBLE_INSTALL_ROOT=${ANSIBLE_INSTALL_ROOT:-/opt/stack} ENABLE_VENV="false" USE_DHCP="false" -USE_VENV="true" +USE_VENV="false" BUILD_IMAGE=true PROVISION_WAIT_TIMEOUT=${PROVISION_WAIT_TIMEOUT:-3600} diff --git a/bifrost/scripts/destroy-env.sh b/bifrost/scripts/destroy-env.sh index 87f792a5..f6eca4e3 100755 --- a/bifrost/scripts/destroy-env.sh +++ b/bifrost/scripts/destroy-env.sh @@ -19,12 +19,17 @@ rm -rf /opt/stack # HOME is normally set by sudo -H rm -rf ${HOME}/.config/openstack -# Delete all libvirt VMs and hosts from vbmc (look for a port number) -for vm in $(vbmc list | awk '/[0-9]/{{ print $2 }}'); do - virsh destroy $vm || true - virsh undefine $vm || true - vbmc delete $vm -done +# bifrost installs everything on venv so we need to look there if virtualbmc is not installed on the host. +if which vbmc &>/dev/null || { [[ -e /opt/stack/bifrost/bin/activate ]] && source /opt/stack/bifrost/bin/activate; }; then + # Delete all libvirt VMs and hosts from vbmc (look for a port number) + for vm in $(vbmc list | awk '/[0-9]/{{ print $2 }}'); do + virsh destroy $vm || true + virsh undefine $vm || true + vbmc delete $vm + done + which vbmc &>/dev/null || { [[ -e /opt/stack/bifrost/bin/activate ]] && deactivate; } +fi + # Destroy all XCI VMs if the previous operation failed [[ -n ${XCI_FLAVOR} ]] && \ for vm in ${TEST_VM_NODE_NAMES}; do diff --git a/xci/file/aio/configure-opnfvhost.yml b/xci/file/aio/configure-opnfvhost.yml index 708ad618..5ef19326 100644 --- a/xci/file/aio/configure-opnfvhost.yml +++ b/xci/file/aio/configure-opnfvhost.yml @@ -1,11 +1,17 @@ --- - hosts: opnfv remote_user: root - vars_files: + gather_facts: true + become: yes vars_files: - ../var/opnfv.yml roles: - role: remove-folders + +- hosts: opnfv + remote_user: root + vars_files: + - ../var/opnfv.yml - { role: clone-repository, project: "openstack/openstack-ansible", repo: "{{ OPENSTACK_OSA_GIT_URL }}", dest: "{{ OPENSTACK_OSA_PATH }}", version: "{{ OPENSTACK_OSA_VERSION }}" } tasks: - name: bootstrap ansible on opnfv host diff --git a/xci/playbooks/configure-localhost.yml b/xci/playbooks/configure-localhost.yml index 10dd6946..915d1959 100644 --- a/xci/playbooks/configure-localhost.yml +++ b/xci/playbooks/configure-localhost.yml @@ -9,6 +9,7 @@ ############################################################################## - hosts: localhost connection: local + become: yes vars_files: - ../var/opnfv.yml pre_tasks: @@ -17,11 +18,20 @@ file: ../var/{{ ansible_os_family }}.yml roles: - role: remove-folders + +- hosts: localhost + connection: local + vars_files: + - ../var/opnfv.yml + pre_tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml + roles: - { role: clone-repository, project: "opnfv/releng-xci", repo: "{{ OPNFV_RELENG_GIT_URL }}", dest: "{{ OPNFV_RELENG_PATH }}", version: "{{ OPNFV_RELENG_VERSION }}" } - { role: clone-repository, project: "openstack/openstack-ansible-openstack_openrc", repo: "{{ OPENSTACK_OSA_OPENRC_GIT_URL }}", dest: "{{ OPENSTACK_OSA_OPENRC_PATH }}", version: "master" } - hosts: localhost connection: local - gather_facts: false vars_files: - ../var/opnfv.yml tasks: @@ -66,7 +76,6 @@ dest: "{{OPNFV_RELENG_PATH}}/xci/var" - hosts: localhost connection: local - gather_facts: false vars_files: - ../var/opnfv.yml tasks: diff --git a/xci/playbooks/configure-opnfvhost.yml b/xci/playbooks/configure-opnfvhost.yml index da478255..84c0d827 100644 --- a/xci/playbooks/configure-opnfvhost.yml +++ b/xci/playbooks/configure-opnfvhost.yml @@ -9,6 +9,7 @@ ############################################################################## - hosts: opnfv remote_user: root + become: yes vars_files: - ../var/flavor-vars.yml - ../var/opnfv.yml @@ -18,6 +19,17 @@ file: ../var/{{ ansible_os_family }}.yml roles: - role: remove-folders + +- hosts: opnfv + remote_user: root + vars_files: + - ../var/flavor-vars.yml + - ../var/opnfv.yml + pre_tasks: + - name: Load distribution variables + include_vars: + file: ../var/{{ ansible_os_family }}.yml + roles: - { role: clone-repository, project: "opnfv/releng-xci", repo: "{{ OPNFV_RELENG_GIT_URL }}", dest: "{{ OPNFV_RELENG_PATH }}", version: "{{ OPNFV_RELENG_VERSION }}" } - { role: clone-repository, project: "openstack/openstack-ansible", repo: "{{ OPENSTACK_OSA_GIT_URL }}", dest: "{{ OPENSTACK_OSA_PATH }}", version: "{{ OPENSTACK_OSA_VERSION }}" } @@ -138,7 +150,6 @@ shell: "/bin/cat {{ ansible_env.HOME }}/.ssh/id_rsa.pub >> ../file/authorized_keys" - hosts: opnfv - gather_facts: no remote_user: root vars_files: - ../var/flavor-vars.yml diff --git a/xci/playbooks/provision-vm-nodes.yml b/xci/playbooks/provision-vm-nodes.yml index 0419dcfc..81fc5755 100644 --- a/xci/playbooks/provision-vm-nodes.yml +++ b/xci/playbooks/provision-vm-nodes.yml @@ -83,21 +83,12 @@ connection: local become: yes vars_files: - - ../var/{{ ansible_os_family }}.yml - ../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 }}" - -- hosts: localhost - connection: local - vars_files: - - ../var/{{ ansible_os_family }}.yml - - ../var/opnfv.yml - tasks: - - name: create and provision VM nodes for the flavor {{ XCI_FLAVOR }} - command: "/bin/bash ./scripts/bifrost-provision.sh" - args: - chdir: "{{ OPENSTACK_BIFROST_PATH }}" diff --git a/xci/xci-deploy.sh b/xci/xci-deploy.sh index 6a661349..19f2c18a 100755 --- a/xci/xci-deploy.sh +++ b/xci/xci-deploy.sh @@ -115,7 +115,13 @@ fi echo "Info: Starting provisining VM nodes using openstack/bifrost" echo "-------------------------------------------------------------------------" cd $XCI_PATH/playbooks +# NOTE(hwoarang) we need newer ansible to work on the following playbook +sudo pip uninstall -y ansible || true +sudo -H pip uninstall -y ansible || true +sudo pip install ansible==${XCI_ANSIBLE_PIP_VERSION} ansible-playbook -i inventory provision-vm-nodes.yml +cd ${OPENSTACK_BIFROST_PATH} +bash ./scripts/bifrost-provision.sh echo "-----------------------------------------------------------------------" echo "Info: VM nodes are provisioned!" source $OPENSTACK_BIFROST_PATH/env-vars @@ -130,8 +136,11 @@ echo # - creates log directory # - copies flavor files such as playbook, inventory, and var file #------------------------------------------------------------------------------- + echo "Info: Configuring localhost for openstack-ansible" echo "-----------------------------------------------------------------------" +# NOTE(hwoarang) we need newer ansible to work on the OSA playbooks +sudo pip install --force-reinstall ansible==${XCI_ANSIBLE_PIP_VERSION} cd $XCI_PATH/playbooks ansible-playbook -i inventory configure-localhost.yml echo "-----------------------------------------------------------------------" |