diff options
-rw-r--r-- | bifrost/playbooks/opnfv-virtual.yaml | 42 | ||||
-rwxr-xr-x | bifrost/scripts/bifrost-provision.sh | 20 | ||||
-rwxr-xr-x | bifrost/scripts/destroy-env.sh | 6 | ||||
-rw-r--r-- | xci/installer/osa/playbooks/configure-opnfvhost.yml | 24 | ||||
-rw-r--r-- | xci/playbooks/prepare-functest.yml | 3 | ||||
-rw-r--r-- | xci/playbooks/roles/configure-network/tasks/main.yml | 2 | ||||
-rw-r--r-- | xci/playbooks/roles/prepare-functest/tasks/main.yml | 26 | ||||
-rw-r--r-- | xci/playbooks/roles/prepare-functest/vars/main.yml | 14 | ||||
-rwxr-xr-x | xci/scripts/vm/start-new-vm.sh | 14 | ||||
-rw-r--r-- | xci/var/Debian.yml | 2 | ||||
-rw-r--r-- | xci/var/RedHat.yml | 2 | ||||
-rw-r--r-- | xci/var/Suse.yml | 2 | ||||
-rw-r--r-- | xci/var/opnfv.yml | 9 | ||||
-rwxr-xr-x | xci/xci-deploy.sh | 19 |
14 files changed, 90 insertions, 95 deletions
diff --git a/bifrost/playbooks/opnfv-virtual.yaml b/bifrost/playbooks/opnfv-virtual.yaml index 2ebf86f8..f44adb4d 100644 --- a/bifrost/playbooks/opnfv-virtual.yaml +++ b/bifrost/playbooks/opnfv-virtual.yaml @@ -9,18 +9,12 @@ --- - hosts: localhost connection: local - name: "Setting pre-test conditions" + name: "Host and Ironic bootstrapping" 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: Remove pre-existing leases file + file: path=/var/lib/misc/dnsmasq.leases state=absent - name: "Override the ipv4_gateway setting" set_fact: ipv4_gateway: "192.168.122.1" @@ -30,14 +24,12 @@ file: path: /httpboot state: directory - become: yes - name: Download the {{ xci_distro }} image checksum file get_url: dest: /httpboot/deployment_image.qcow2.sha256.txt force: no url: http://artifacts.opnfv.org/releng/xci/images/{{ xci_distro }}.qcow2.sha256.txt timeout: 3000 - become: yes - name: Extract checksum shell: awk '{print $1}' /httpboot/deployment_image.qcow2.sha256.txt register: _image_checksum @@ -53,27 +45,17 @@ timeout: 3000 dest: /httpboot/deployment_image.qcow2 force: no - become: yes - name: Set correct mode for {{ xci_distro }}.qcow2 file file: path: /httpboot/deployment_image.qcow2 mode: '0755' owner: 'root' group: 'root' - become: yes when: use_prebuilt_images | bool == true 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-prep-for-install + when: skip_install is not defined - role: bifrost-keystone-install - role: bifrost-ironic-install cleaning: false @@ -118,22 +100,20 @@ 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" + name: "Enrollment and Deployment" vars: multinode_testing: "{{ inventory_dhcp | bool == true }}" become: no connection: local + gather_facts: yes roles: + - role: ironic-enroll-dynamic + - { role: ironic-inspect-node, when: inspect_nodes | default('false') | bool == true } - role: bifrost-configdrives-dynamic - role: bifrost-deploy-nodes-dynamic + - hosts: baremetal name: "Deploy machines." become: no diff --git a/bifrost/scripts/bifrost-provision.sh b/bifrost/scripts/bifrost-provision.sh index dccb3231..726a4da4 100755 --- a/bifrost/scripts/bifrost-provision.sh +++ b/bifrost/scripts/bifrost-provision.sh @@ -77,6 +77,26 @@ export DIB_OS_PACKAGES=${DIB_OS_PACKAGES:-"vlan,vim,less,bridge-utils,language-p # Additional dib elements export EXTRA_DIB_ELEMENTS=${EXTRA_DIB_ELEMENTS:-"openssh-server"} +# dib configuration +case ${XCI_DISTRO,,} in + # These should ideally match the CI jobs + ubuntu) + export DIB_OS_RELEASE="${DIB_OS_RELEASE:-xenial}" + export DIB_OS_ELEMENT="${DIB_OS_ELEMENT:-ubuntu-minimal}" + export DIB_OS_PACKAGES="${DIB_OS_PACKAGES:-vlan,vim,less,bridge-utils,language-pack-en,iputils-ping,rsyslog,curl,iptables}" + ;; + centos) + export DIB_OS_RELEASE="${DIB_OS_RELEASE:-7}" + export DIB_OS_ELEMENT="${DIB_OS_ELEMENT:-centos-minimal}" + export DIB_OS_PACKAGES="${DIB_OS_PACKAGES:-vim,less,bridge-utils,iputils,rsyslog,curl,iptables}" + ;; + opensuse) + export DIB_OS_RELEASE="${DIB_OS_RELEASE:-42.3}" + export DIB_OS_ELEMENT="${DIB_OS_ELEMENT:-opensuse-minimal}" + export DIB_OS_PACKAGES="${DIB_OS_PACKAGES:-vim,less,bridge-utils,iputils,rsyslog,curl,iptables}" + ;; +esac + # Copy the OS images if found if [[ -e ${XCI_PATH}/deployment_image.qcow2 ]]; then sudo mkdir -p /httpboot diff --git a/bifrost/scripts/destroy-env.sh b/bifrost/scripts/destroy-env.sh index 3ee66642..97638303 100755 --- a/bifrost/scripts/destroy-env.sh +++ b/bifrost/scripts/destroy-env.sh @@ -23,8 +23,10 @@ rm -rf ${HOME}/.config/openstack 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 + if which virsh &>/dev/null; then + virsh destroy $vm || true + virsh undefine $vm || true + fi vbmc delete $vm done which vbmc &>/dev/null || { [[ -e /opt/stack/bifrost/bin/activate ]] && deactivate; } diff --git a/xci/installer/osa/playbooks/configure-opnfvhost.yml b/xci/installer/osa/playbooks/configure-opnfvhost.yml index deeab182..2996236b 100644 --- a/xci/installer/osa/playbooks/configure-opnfvhost.yml +++ b/xci/installer/osa/playbooks/configure-opnfvhost.yml @@ -11,6 +11,7 @@ remote_user: root vars_files: - "{{ XCI_PATH }}/xci/var/opnfv.yml" + - "{{ XCI_PATH }}/xci/installer/osa/files/openstack_services.yml" pre_tasks: - name: Load distribution variables @@ -103,10 +104,15 @@ - name: install python Crypto module package: name: "{{ python_crypto_package_name }}" - - name: install PyYAML + - name: install opnfv pip required packages pip: - name: pyyaml + name: "{{ item }}" state: present + extra_args: '-c https://raw.githubusercontent.com/openstack/requirements/{{ requirements_git_install_branch }}/upper-constraints.txt' + with_items: + - pyyaml + - python-neutronclient + - python-openstackclient - name: generate password token command: "python pw-token-gen.py --file {{OPENSTACK_OSA_ETC_PATH}}/user_secrets.yml" args: @@ -135,20 +141,6 @@ content: "{{ xci_ssl_key }}" dest: "/etc/ssl/private/xci.key" become: true - - name: install opnfv required packages - package: - name: "{{ opnfv_required_packages }}" - state: latest - # Docker is needed for functest - - name: Ensure Docker service is started and enabled - service: - name: "{{ docker_service_name }}" - state: started - enabled: yes - - name: install opnfv required pip packages - pip: - name: "{{ opnfv_required_pip }}" - state: present - hosts: localhost remote_user: root diff --git a/xci/playbooks/prepare-functest.yml b/xci/playbooks/prepare-functest.yml index 6d5b01c6..a4cb664b 100644 --- a/xci/playbooks/prepare-functest.yml +++ b/xci/playbooks/prepare-functest.yml @@ -16,5 +16,8 @@ - name: Prepare the environment for functest hosts: opnfv user: root + vars_files: + - ../var/opnfv.yml + - ../installer/osa/files/openstack_services.yml roles: - role: "prepare-functest" diff --git a/xci/playbooks/roles/configure-network/tasks/main.yml b/xci/playbooks/roles/configure-network/tasks/main.yml index 21f213cb..01edf459 100644 --- a/xci/playbooks/roles/configure-network/tasks/main.yml +++ b/xci/playbooks/roles/configure-network/tasks/main.yml @@ -17,7 +17,7 @@ network_packages: - bridge-utils - "{{ (ansible_pkg_mgr in ['zypper', 'apt']) | ternary('iproute2', 'iproute') }}" - - "{{ (ansible_pkg_mgr == 'apt') | ternary('vlan', '') }}" + - "{{ (ansible_pkg_mgr == 'apt') | ternary('vlan', 'bridge-utils') }}" - iptables - name: Ensure networking packages are present diff --git a/xci/playbooks/roles/prepare-functest/tasks/main.yml b/xci/playbooks/roles/prepare-functest/tasks/main.yml index 243358fc..2797ce43 100644 --- a/xci/playbooks/roles/prepare-functest/tasks/main.yml +++ b/xci/playbooks/roles/prepare-functest/tasks/main.yml @@ -7,6 +7,25 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## + +- name: install functest required packages + package: + name: "{{ functest_required_packages[ansible_pkg_mgr] }}" + state: present + +# Docker is needed for functest +- name: Ensure Docker service is started and enabled + service: + name: docker + state: started + enabled: yes + +- name: install functest required pip packages + pip: + name: "{{ functest_required_pip }}" + state: present + extra_args: '-c https://raw.githubusercontent.com/openstack/requirements/{{ requirements_git_install_branch }}/upper-constraints.txt' + - name: check if the gateway was already set shell: "ip a | grep {{ gateway_ip }}" register: gateway_ip_result @@ -27,10 +46,3 @@ src: run-functest.sh.j2 dest: /root/run-functest.sh mode: 0755 - -- name: install required packages - package: - name: "{{ item }}" - state: present - with_items: - - wget diff --git a/xci/playbooks/roles/prepare-functest/vars/main.yml b/xci/playbooks/roles/prepare-functest/vars/main.yml new file mode 100644 index 00000000..3a6c8a4d --- /dev/null +++ b/xci/playbooks/roles/prepare-functest/vars/main.yml @@ -0,0 +1,14 @@ +--- +functest_required_packages: + apt: + - docker.io + - wget + zypper: + - docker + - wget + yum: + - docker + - wget + +functest_required_pip: + - docker-py diff --git a/xci/scripts/vm/start-new-vm.sh b/xci/scripts/vm/start-new-vm.sh index 868de6c3..76506830 100755 --- a/xci/scripts/vm/start-new-vm.sh +++ b/xci/scripts/vm/start-new-vm.sh @@ -119,13 +119,17 @@ COMMON_DISTRO_PKGS=(vim strace gdb htop dnsmasq docker iptables ebtables virt-ma case ${ID,,} in *suse) - pkg_mgr_cmd="sudo zypper -q -n install ${COMMON_DISTRO_PKGS[@]} qemu-kvm qemu-tools libvirt-daemon libvirt-client libvirt-daemon-driver-qemu" + pkg_mgr_cmd="sudo zypper -q -n ref" + pkg_mgr_cmd+=" && sudo zypper -q -n install ${COMMON_DISTRO_PKGS[@]} qemu-kvm qemu-tools libvirt-daemon libvirt-client libvirt-daemon-driver-qemu" ;; centos) - pkg_mgr_cmd="sudo yum install -q -y epel-release && sudo yum install -q -y in ${COMMON_DISTRO_PKGS[@]} qemu-kvm-tools qemu-img libvirt-daemon-kvm" + pkg_mgr_cmd="yum updateinfo" + pkg_mgr_cmd+=" && sudo yum install -q -y epel-release" + pkg_mgr_cmd+=" && sudo yum install -q -y in ${COMMON_DISTRO_PKGS[@]} qemu-kvm-tools qemu-img libvirt-daemon-kvm" ;; ubuntu) - pkg_mgr_cmd="sudo apt-get install -y -q=3 ${COMMON_DISTRO_PKGS[@]} libvirt-bin qemu-utils docker.io" + pkg_mgr_cmd="sudo apt-get update" + pkg_mgr_cmd+=" && sudo apt-get install -y -q=3 ${COMMON_DISTRO_PKGS[@]} libvirt-bin qemu-utils docker.io" ;; esac @@ -141,7 +145,9 @@ while true; do done echo "Installing host (${ID,,}) dependencies..." -eval ${pkg_mgr_cmd} &> /dev/null +set +e +eval ${pkg_mgr_cmd} +set -e echo "Ensuring libvirt and docker services are running..." sudo systemctl -q start libvirtd diff --git a/xci/var/Debian.yml b/xci/var/Debian.yml index ad3621b6..c785c65c 100644 --- a/xci/var/Debian.yml +++ b/xci/var/Debian.yml @@ -9,5 +9,3 @@ ############################################################################## # this is the interface the VM nodes are connected to libvirt network "default" python_crypto_package_name: python-crypto -docker_package_name: docker.io -docker_service_name: docker diff --git a/xci/var/RedHat.yml b/xci/var/RedHat.yml index 8ea2e15a..eae7d127 100644 --- a/xci/var/RedHat.yml +++ b/xci/var/RedHat.yml @@ -9,5 +9,3 @@ ############################################################################## # this is placeholder and left blank intentionally to complete later on python_crypto_package_name: python-crypto -docker_package_name: docker -docker_service_name: docker diff --git a/xci/var/Suse.yml b/xci/var/Suse.yml index 5066defa..5891aee9 100644 --- a/xci/var/Suse.yml +++ b/xci/var/Suse.yml @@ -9,5 +9,3 @@ ############################################################################## # this is the interface the VM nodes are connected to libvirt network "default" python_crypto_package_name: python-pycrypto -docker_package_name: docker -docker_service_name: docker diff --git a/xci/var/opnfv.yml b/xci/var/opnfv.yml index d3924bf0..f438e577 100644 --- a/xci/var/opnfv.yml +++ b/xci/var/opnfv.yml @@ -43,12 +43,3 @@ OPENSTACK_OSA_HAPROXY_GIT_URL: "{{ lookup('env','OPENSTACK_OSA_HAPROXY_GIT_URL') HAPROXY_VERSION: "{{ lookup('env','HAPROXY_VERSION') }}" KEEPALIVED_GIT_URL: "{{ lookup('env','KEEPALIVED_GIT_URL') }}" KEEPALIVED_VERSION: "{{ lookup('env','KEEPALIVED_VERSION') }}" - -# install docker on opnfv host only if we are running as part of CI -opnfv_required_packages: - - "{{ docker_package_name }}" - -opnfv_required_pip: - - python-openstackclient - - python-neutronclient - - docker-py diff --git a/xci/xci-deploy.sh b/xci/xci-deploy.sh index 11800440..77d12535 100755 --- a/xci/xci-deploy.sh +++ b/xci/xci-deploy.sh @@ -103,25 +103,6 @@ echo "-------------------------------------------------------------------------" bash files/install-ansible.sh echo "-------------------------------------------------------------------------" -case ${XCI_DISTRO,,} in - # These should ideally match the CI jobs - ubuntu) - export DIB_OS_RELEASE="${DIB_OS_RELEASE:-xenial}" - export DIB_OS_ELEMENT="${DIB_OS_ELEMENT:-ubuntu-minimal}" - export DIB_OS_PACKAGES="${DIB_OS_PACKAGES:-vlan,vim,less,bridge-utils,language-pack-en,iputils-ping,rsyslog,curl,iptables}" - ;; - centos) - export DIB_OS_RELEASE="${DIB_OS_RELEASE:-7}" - export DIB_OS_ELEMENT="${DIB_OS_ELEMENT:-centos-minimal}" - export DIB_OS_PACKAGES="${DIB_OS_PACKAGES:-vim,less,bridge-utils,iputils,rsyslog,curl,iptables}" - ;; - opensuse) - export DIB_OS_RELEASE="${DIB_OS_RELEASE:-42.3}" - export DIB_OS_ELEMENT="${DIB_OS_ELEMENT:-opensuse-minimal}" - export DIB_OS_PACKAGES="${DIB_OS_PACKAGES:-vim,less,bridge-utils,iputils,rsyslog,curl,iptables}" - ;; -esac - # Clone OPNFV scenario repositories #------------------------------------------------------------------------------- # This playbook |