From a88b258312d3c858b1b1167dfd03a09a6e28cacd Mon Sep 17 00:00:00 2001 From: Fatih Degirmenci Date: Mon, 20 Mar 2017 15:01:52 +0100 Subject: xci: Enable VM provisioning using bifrost for daily runs - create script to provision VMs (log upload is not enabled yet) - remove leftover inventory files (baremetal.csv, baremetal.json) - set BIFROST_INVENTORY_SOURCE as needed by stable/ocata - rename playbook used during bifrost and adjust scripts using it - remove puppet-infracloud stuff Change-Id: I1c4412d0725c00ab9a1b3497e358d33998b4e7e6 Signed-off-by: Fatih Degirmenci --- prototypes/bifrost/playbooks/opnfv-virtual.yaml | 85 ++++++++++++++++++++++ .../bifrost/playbooks/test-bifrost-infracloud.yaml | 85 ---------------------- prototypes/bifrost/scripts/destroy-env.sh | 3 + .../bifrost/scripts/osa-bifrost-deployment.sh | 15 ++-- .../bifrost/scripts/test-bifrost-deployment.sh | 5 +- 5 files changed, 98 insertions(+), 95 deletions(-) create mode 100644 prototypes/bifrost/playbooks/opnfv-virtual.yaml delete mode 100644 prototypes/bifrost/playbooks/test-bifrost-infracloud.yaml (limited to 'prototypes') diff --git a/prototypes/bifrost/playbooks/opnfv-virtual.yaml b/prototypes/bifrost/playbooks/opnfv-virtual.yaml new file mode 100644 index 000000000..310eca864 --- /dev/null +++ b/prototypes/bifrost/playbooks/opnfv-virtual.yaml @@ -0,0 +1,85 @@ +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2016 RedHat and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +--- +- hosts: localhost + connection: local + name: "Setting pre-test conditions" + become: yes + ignore_errors: yes + tasks: + - name: Remove pre-existing leases file + file: path=/var/lib/misc/dnsmasq.leases state=absent +- hosts: localhost + connection: local + name: "Executes install, enrollment, and testing in one playbook" + become: no + gather_facts: yes + pre_tasks: + - name: "Override the ipv4_gateway setting" + set_fact: + ipv4_gateway: "192.168.122.1" + roles: + - { role: bifrost-prep-for-install, when: skip_install is not defined } + environment: + http_proxy: "{{ lookup('env','http_proxy') }}" + https_proxy: "{{ lookup('env','https_proxy') }}" +- hosts: localhost + connection: local + name: "Executes install, enrollment, and testing in one playbook" + become: yes + gather_facts: yes + roles: + - role: bifrost-ironic-install + cleaning: false + testing: true + # NOTE(TheJulia): While the next step creates a ramdisk, some elements + # do not support ramdisk-image-create as they invoke steps to cleanup + # the ramdisk which causes ramdisk-image-create to believe it failed. + - role: bifrost-create-dib-image + dib_imagename: "{{ http_boot_folder }}/ipa" + build_ramdisk: false + dib_os_element: "{{ ipa_dib_os_element|default('debian') }}" + dib_os_release: "jessie" + dib_elements: "ironic-agent {{ ipa_extra_dib_elements | default('') }}" + when: create_ipa_image | bool == true + - role: bifrost-create-dib-image + dib_imagetype: "qcow2" + dib_imagename: "{{deploy_image}}" + dib_os_element: "{{ lookup('env','DIB_OS_ELEMENT') }}" + dib_os_release: "{{ lookup('env', 'DIB_OS_RELEASE') }}" + extra_dib_elements: "{{ lookup('env', 'EXTRA_DIB_ELEMENTS') | default('') }}" + dib_elements: "vm enable-serial-console simple-init devuser growroot {{ extra_dib_elements }}" + dib_packages: "{{ lookup('env', 'DIB_OS_PACKAGES') }}" + when: create_image_via_dib | bool == true and transform_boot_image | bool == false + environment: + http_proxy: "{{ lookup('env','http_proxy') }}" + https_proxy: "{{ lookup('env','https_proxy') }}" +- hosts: baremetal + name: "Enroll node with Ironic" + become: no + connection: local + roles: + - role: ironic-enroll-dynamic + - { role: ironic-inspect-node, when: inspect_nodes | default('false') | bool == true } +- hosts: baremetal + name: "Create configuration drive files and deploy machines" + vars: + multinode_testing: "{{ inventory_dhcp | bool == true }}" + become: no + connection: local + roles: + - role: bifrost-configdrives-dynamic + - role: bifrost-deploy-nodes-dynamic +- hosts: baremetal + name: "Deploy machines." + become: no + connection: local + serial: 1 + roles: + - role: bifrost-prepare-for-test-dynamic diff --git a/prototypes/bifrost/playbooks/test-bifrost-infracloud.yaml b/prototypes/bifrost/playbooks/test-bifrost-infracloud.yaml deleted file mode 100644 index 07d5e245b..000000000 --- a/prototypes/bifrost/playbooks/test-bifrost-infracloud.yaml +++ /dev/null @@ -1,85 +0,0 @@ -# SPDX-license-identifier: Apache-2.0 -############################################################################## -# Copyright (c) 2016 RedHat and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -- hosts: localhost - connection: local - name: "Setting pre-test conditions" - become: yes - ignore_errors: yes - tasks: - - name: Remove pre-existing leases file - file: path=/var/lib/misc/dnsmasq.leases state=absent -- hosts: localhost - connection: local - name: "Executes install, enrollment, and testing in one playbook" - become: no - gather_facts: yes - pre_tasks: - - name: "Override the ipv4_gateway setting" - set_fact: - ipv4_gateway: "192.168.122.1" - roles: - - { role: bifrost-prep-for-install, when: skip_install is not defined } - environment: - http_proxy: "{{ lookup('env','http_proxy') }}" - https_proxy: "{{ lookup('env','https_proxy') }}" -- hosts: localhost - connection: local - name: "Executes install, enrollment, and testing in one playbook" - become: yes - gather_facts: yes - roles: - - role: bifrost-ironic-install - cleaning: false - testing: true - # NOTE(TheJulia): While the next step creates a ramdisk, some elements - # do not support ramdisk-image-create as they invoke steps to cleanup - # the ramdisk which causes ramdisk-image-create to believe it failed. - - role: bifrost-create-dib-image - dib_imagename: "{{ http_boot_folder }}/ipa" - build_ramdisk: false - dib_os_element: "{{ ipa_dib_os_element|default('debian') }}" - dib_os_release: "jessie" - dib_elements: "ironic-agent {{ ipa_extra_dib_elements | default('') }}" - when: create_ipa_image | bool == true - - role: bifrost-create-dib-image - dib_imagetype: "qcow2" - dib_imagename: "{{deploy_image}}" - dib_os_element: "{{ lookup('env','DIB_OS_ELEMENT') }}" - dib_os_release: "{{ lookup('env', 'DIB_OS_RELEASE') }}" - extra_dib_elements: "{{ lookup('env', 'EXTRA_DIB_ELEMENTS') | default('') }}" - dib_elements: "vm enable-serial-console simple-init devuser infra-cloud-bridge puppet growroot {{ extra_dib_elements }}" - dib_packages: "{{ lookup('env', 'DIB_OS_PACKAGES') }}" - when: create_image_via_dib | bool == true and transform_boot_image | bool == false - environment: - http_proxy: "{{ lookup('env','http_proxy') }}" - https_proxy: "{{ lookup('env','https_proxy') }}" -- hosts: baremetal - name: "Enroll node with Ironic" - become: no - connection: local - roles: - - role: ironic-enroll-dynamic - - { role: ironic-inspect-node, when: inspect_nodes | default('false') | bool == true } -- hosts: baremetal - name: "Create configuration drive files and deploy machines" - vars: - multinode_testing: "{{ inventory_dhcp | bool == true }}" - become: no - connection: local - roles: - - role: bifrost-configdrives-dynamic - - role: bifrost-deploy-nodes-dynamic -- hosts: baremetal - name: "Deploy machines." - become: no - connection: local - serial: 1 - roles: - - role: bifrost-prepare-for-test-dynamic diff --git a/prototypes/bifrost/scripts/destroy-env.sh b/prototypes/bifrost/scripts/destroy-env.sh index 1138da904..7d3db90b0 100755 --- a/prototypes/bifrost/scripts/destroy-env.sh +++ b/prototypes/bifrost/scripts/destroy-env.sh @@ -27,6 +27,9 @@ done service ironic-conductor stop || true +echo "removing inventory files created by previous builds" +rm -rf /tmp/baremetal.* + echo "removing ironic database" if $(which mysql &> /dev/null); then mysql -u root ironic --execute "drop database ironic;" diff --git a/prototypes/bifrost/scripts/osa-bifrost-deployment.sh b/prototypes/bifrost/scripts/osa-bifrost-deployment.sh index cca30c2fc..bd6e54383 100755 --- a/prototypes/bifrost/scripts/osa-bifrost-deployment.sh +++ b/prototypes/bifrost/scripts/osa-bifrost-deployment.sh @@ -18,7 +18,8 @@ ENABLE_VENV="false" USE_DHCP="false" USE_VENV="false" BUILD_IMAGE=true -BAREMETAL_DATA_FILE=${BAREMETAL_DATA_FILE:-'/tmp/baremetal.json'} +export BAREMETAL_DATA_FILE=${BAREMETAL_DATA_FILE:-'/tmp/baremetal.json'} +export BIFROST_INVENTORY_SOURCE=${BIFROST_INVENTORY_SOURCE:-'/tmp/baremetal.csv'} PROVISION_WAIT_TIMEOUT=${PROVISION_WAIT_TIMEOUT:-3600} # Set defaults for ansible command-line options to drive the different @@ -39,7 +40,7 @@ export VM_DOMAIN_TYPE="kvm" export VM_CPU=${VM_CPU:-8} export VM_DISK=${VM_DISK:-100} export VM_DISK_CACHE=${VM_DISK_CACHE:-unsafe} -TEST_PLAYBOOK="test-bifrost-infracloud.yaml" +TEST_PLAYBOOK="opnfv-virtual.yaml" USE_INSPECTOR=true USE_CIRROS=false TESTING_USER=root @@ -53,8 +54,6 @@ INVENTORY_DHCP=false INVENTORY_DHCP_STATIC_IP=false WRITE_INTERFACES_FILE=true -# Set BIFROST_INVENTORY_SOURCE -export BIFROST_INVENTORY_SOURCE=/tmp/baremetal.json # DIB custom elements path export ELEMENTS_PATH=/opt/puppet-infracloud/files/elements @@ -93,11 +92,11 @@ cd $BIFROST_HOME/playbooks # Syntax check of dynamic inventory test path for task in syntax-check list-tasks; do - ${ANSIBLE} -vvvv \ + ${ANSIBLE} \ -i inventory/localhost \ test-bifrost-create-vm.yaml \ --${task} - ${ANSIBLE} -vvvv \ + ${ANSIBLE} \ -i inventory/localhost \ ${TEST_PLAYBOOK} \ --${task} \ @@ -105,7 +104,7 @@ for task in syntax-check list-tasks; do done # Create the test VMS -${ANSIBLE} -vvvv \ +${ANSIBLE} \ -i inventory/localhost \ test-bifrost-create-vm.yaml \ -e test_vm_num_nodes=${TEST_VM_NUM_NODES} \ @@ -115,7 +114,7 @@ ${ANSIBLE} -vvvv \ -e baremetal_json_file=${BAREMETAL_DATA_FILE} # Execute the installation and VM startup test. -${ANSIBLE} -vvvv \ +${ANSIBLE} \ -i inventory/bifrost_inventory.py \ ${TEST_PLAYBOOK} \ -e use_cirros=${USE_CIRROS} \ diff --git a/prototypes/bifrost/scripts/test-bifrost-deployment.sh b/prototypes/bifrost/scripts/test-bifrost-deployment.sh index b7165ffd1..3c3b6bacb 100755 --- a/prototypes/bifrost/scripts/test-bifrost-deployment.sh +++ b/prototypes/bifrost/scripts/test-bifrost-deployment.sh @@ -18,7 +18,8 @@ ENABLE_VENV="false" USE_DHCP="false" USE_VENV="false" BUILD_IMAGE=true -BAREMETAL_DATA_FILE=${BAREMETAL_DATA_FILE:-'/tmp/baremetal.json'} +export BAREMETAL_DATA_FILE=${BAREMETAL_DATA_FILE:-'/tmp/baremetal.json'} +export BIFROST_INVENTORY_SOURCE=${BIFROST_INVENTORY_SOURCE:-'/tmp/baremetal.csv'} PROVISION_WAIT_TIMEOUT=${PROVISION_WAIT_TIMEOUT:-3600} # Set defaults for ansible command-line options to drive the different @@ -38,7 +39,7 @@ export VM_DOMAIN_TYPE="kvm" export VM_CPU=${VM_CPU:-4} export VM_DISK=${VM_DISK:-100} export VM_DISK_CACHE=${VM_DISK_CACHE:-unsafe} -TEST_PLAYBOOK="test-bifrost-infracloud.yaml" +TEST_PLAYBOOK="opnfv-virtual.yaml" USE_INSPECTOR=true USE_CIRROS=false TESTING_USER=root -- cgit 1.2.3-korg