diff options
Diffstat (limited to 'xci')
19 files changed, 241 insertions, 203 deletions
diff --git a/xci/Vagrantfile b/xci/Vagrantfile deleted file mode 100644 index d58ed62e..00000000 --- a/xci/Vagrantfile +++ /dev/null @@ -1,140 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Verify whether required plugins are installed. -required_plugins = [ "vagrant-disksize" ] -required_plugins.each do |plugin| - if not Vagrant.has_plugin?(plugin) - raise "The vagrant plugin #{plugin} is required. Please run `vagrant plugin install #{plugin}`" - end -end - -Vagrant.configure(2) do |config| - - # Configure all VM specs. - config.vm.provider "virtualbox" do |v| - v.memory = 8192 - v.cpus = 8 - end - - # Configure the disk size. - disk_size = "160GB" - - # The below options are good enough for the 'mini' flavor but - # make sure you export the variables to match the flavor you want to test. - config.vm.define "ubuntu1604" do |xenial| - xenial.vm.box = "ubuntu/xenial64" - xenial.disksize.size = disk_size - config.vm.provision "shell"do |s| - s.privileged = false - s.inline = <<-SHELL - cd /vagrant - export XCI_FLAVOR=${XCI_FLAVOR:-mini} - export VM_CPU=${VM_CPU:-2} - export VM_DISK=${VM_DISK:-40} - export VM_MEMORY_SIZE=${VM_MEMORY_SIZE:-2048} - export VM_DOMAIN_TYPE=qemu - [[ ! -e ${HOME}/.ssh/id_rsa ]] && ssh-keygen -q -P '' -f ${HOME}/.ssh/id_rsa - ./xci-deploy.sh - SHELL - s.env = { - "XCI_FLAVOR" => "#{ENV['XCI_FLAVOR']}", - "VM_CPU" => "#{ENV['VM_CPU']}", - "VM_DISK" => "#{ENV['VM_DISK']}", - "VM_MEMORY_SIZE" => "#{ENV['VM_MEMORY_SIZE']}" - } - end - end - - config.vm.define "centos7" do |centos7| - centos7.vm.box = "centos/7" - centos7.disksize.size = disk_size - # The CentOS build does not have growroot, so we - # have to do it ourselves. - config.vm.provision "shell" do |s| - s.privileged = false - s.inline = <<-SHELL - cd /vagrant - PART_START=$(parted /dev/sda --script unit MB print | awk '/^ 3 / {print $3}') - parted /dev/sda --script unit MB mkpart primary ${PART_START} 100% - parted /dev/sda --script set 4 lvm on - pvcreate /dev/sda4 - vgextend VolGroup00 /dev/sda4 - lvextend -l +100%FREE /dev/mapper/VolGroup00-LogVol00 - xfs_growfs /dev/mapper/VolGroup00-LogVol00 - export XCI_FLAVOR=${XCI_FLAVOR:-mini} - export VM_CPU=${VM_CPU:-2} - export VM_DISK=${VM_DISK:-40} - export VM_MEMORY_SIZE=${VM_MEMORY_SIZE:-2048} - export VM_DOMAIN_TYPE=qemu - [[ ! -e ${HOME}/.ssh/id_rsa ]] && ssh-keygen -q -P '' -f ${HOME}/.ssh/id_rsa - ./xci-deploy.sh - SHELL - s.env = { - "XCI_FLAVOR" => "#{ENV['XCI_FLAVOR']}", - "VM_CPU" => "#{ENV['VM_CPU']}", - "VM_DISK" => "#{ENV['VM_DISK']}", - "VM_MEMORY_SIZE" => "#{ENV['VM_MEMORY_SIZE']}" - } - end - end - - config.vm.define "opensuse422" do |leap422| - leap422.disksize.size = disk_size - leap422.vm.box = "opensuse/openSUSE-42.2-x86_64" - leap422.vm.provision "shell" do |s| - # NOTE(hwoarang) The parted version in Leap 42.2 can't do an online - # partition resize so we must create a new one and attach it to the - # btrfs filesystem. - s.privileged = true, - s.inline = <<-SHELL - cd /vagrant - echo -e 'd\n2\nn\np\n\n\n\nn\nw' | fdisk /dev/sda - PART_END=$(fdisk -l /dev/sda | grep ^/dev/sda2 | awk '{print $4}') - resizepart /dev/sda 2 $PART_END - btrfs fi resize max / - export XCI_FLAVOR=${XCI_FLAVOR:-mini} - export VM_CPU=${VM_CPU:-2} - export VM_DISK=${VM_DISK:-40} - export VM_MEMORY_SIZE=${VM_MEMORY_SIZE:-2048} - export VM_DOMAIN_TYPE=qemu - [[ ! -e ${HOME}/.ssh/id_rsa ]] && ssh-keygen -q -P '' -f ${HOME}/.ssh/id_rsa - ./xci-deploy.sh - SHELL - end - end - - config.vm.define "opensuse423" do |leap423| - leap423.disksize.size = disk_size - leap423.vm.box = "opensuse/openSUSE-42.3-x86_64" - leap423.vm.provision "shell" do |s| - # NOTE(hwoarang) The parted version in Leap 42.3 can't do an online - # partition resize so we must create a new one and attach it to the - # btrfs filesystem. - s.privileged = true, - s.inline = <<-SHELL - cd /vagrant - echo -e 'd\n2\nn\np\n\n\n\nn\nw' | fdisk /dev/sda - PART_END=$(fdisk -l /dev/sda | grep ^/dev/sda2 | awk '{print $4}') - resizepart /dev/sda 2 $PART_END - btrfs fi resize max / - export XCI_FLAVOR=${XCI_FLAVOR:-mini} - export VM_CPU=${VM_CPU:-2} - export VM_DISK=${VM_DISK:-40} - export VM_MEMORY_SIZE=${VM_MEMORY_SIZE:-2048} - export VM_DOMAIN_TYPE=qemu - [[ ! -e ${HOME}/.ssh/id_rsa ]] && ssh-keygen -q -P '' -f ${HOME}/.ssh/id_rsa - ./xci-deploy.sh - SHELL - end - end -end diff --git a/xci/config/env-vars b/xci/config/env-vars index d8e71244..c399707b 100755 --- a/xci/config/env-vars +++ b/xci/config/env-vars @@ -17,10 +17,5 @@ export JOB_NAME=${JOB_NAME:-false} # Overall, it's better to use what OSA supports so we can use new features. export XCI_ANSIBLE_PIP_VERSION=2.3.2.0 export ANSIBLE_HOST_KEY_CHECKING=False -export DISTRO=${DISTRO:-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,sudo,language-pack-en,iputils-ping,rsyslog,curl,python,debootstrap,ifenslave,ifenslave-2.6,lsof,lvm2,tcpdump,nfs-kernel-server,chrony,iptables"} -export EXTRA_DIB_ELEMENTS=${EXTRA_DIB_ELEMENTS:-"openssh-server"} # subject of the certificate export XCI_SSL_SUBJECT=${XCI_SSL_SUBJECT:-"/C=US/ST=California/L=San Francisco/O=IT/CN=xci.releng.opnfv.org"} 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/file/ha/openstack_user_config.yml b/xci/file/ha/openstack_user_config.yml index 09fb734c..360aa5cb 100644 --- a/xci/file/ha/openstack_user_config.yml +++ b/xci/file/ha/openstack_user_config.yml @@ -9,6 +9,7 @@ used_ips: - "172.29.240.1,172.29.240.50" - "172.29.244.1,172.29.244.50" - "172.29.248.1,172.29.248.50" + - "172.29.236.222" global_overrides: internal_lb_vip_address: 172.29.236.222 diff --git a/xci/playbooks/configure-localhost.yml b/xci/playbooks/configure-localhost.yml index 2dfa0530..915d1959 100644 --- a/xci/playbooks/configure-localhost.yml +++ b/xci/playbooks/configure-localhost.yml @@ -9,20 +9,35 @@ ############################################################################## - hosts: localhost connection: local + become: yes 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 + +- 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/{{ 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 }}" @@ -35,9 +50,11 @@ - 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}}" @@ -59,11 +76,12 @@ dest: "{{OPNFV_RELENG_PATH}}/xci/var" - hosts: localhost 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" diff --git a/xci/playbooks/configure-opnfvhost.yml b/xci/playbooks/configure-opnfvhost.yml index d45c1be8..067a1176 100644 --- a/xci/playbooks/configure-opnfvhost.yml +++ b/xci/playbooks/configure-opnfvhost.yml @@ -9,21 +9,38 @@ ############################################################################## - hosts: opnfv remote_user: root + become: yes 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 + +- 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 }}" } - 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 }}" @@ -44,9 +61,12 @@ - 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: @@ -132,13 +152,15 @@ shell: "/bin/cat {{ ansible_env.HOME }}/.ssh/id_rsa.pub >> ../file/authorized_keys" - hosts: opnfv - 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: diff --git a/xci/playbooks/configure-targethosts.yml b/xci/playbooks/configure-targethosts.yml index 88da1312..4cee1df8 100644 --- a/xci/playbooks/configure-targethosts.yml +++ b/xci/playbooks/configure-targethosts.yml @@ -10,8 +10,11 @@ - 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 @@ -20,8 +23,11 @@ - 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 @@ -29,6 +35,5 @@ - hosts: compute00 remote_user: root - # TODO: this role is for configuring NFS on xenial and adjustment needed for other distros roles: - role: configure-nfs diff --git a/xci/playbooks/provision-vm-nodes.yml b/xci/playbooks/provision-vm-nodes.yml index e9b8fa2d..81fc5755 100644 --- a/xci/playbooks/provision-vm-nodes.yml +++ b/xci/playbooks/provision-vm-nodes.yml @@ -9,22 +9,35 @@ ############################################################################## - hosts: localhost connection: local + gather_facts: true + become: yes vars_files: - - ../var/{{ ansible_os_family }}.yml - ../var/opnfv.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: true + 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: "opnfv/bifrost", repo: "{{ OPENSTACK_BIFROST_GIT_URL }}", dest: "{{ OPENSTACK_BIFROST_PATH }}", version: "{{ OPENSTACK_BIFROST_VERSION }}" } - 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: @@ -54,11 +67,13 @@ - 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/" @@ -68,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/playbooks/roles/configure-network/files/network-config-suse b/xci/playbooks/roles/configure-network/files/network-config-suse new file mode 100755 index 00000000..1a9f1e7d --- /dev/null +++ b/xci/playbooks/roles/configure-network/files/network-config-suse @@ -0,0 +1,15 @@ +#!/bin/bash + +INTERFACE=$1 +ACTION=$4 + +if [[ $INTERFACE == "br-vlan" ]]; then + if [[ $ACTION == "pre-up" ]]; then + ip link add br-vlan-veth type veth peer name eth12 || true + ip link set br-vlan-veth up + ip link set eth12 up + else + ip link del br-vlan-veth || true + fi +fi + diff --git a/xci/playbooks/roles/configure-network/tasks/main.yml b/xci/playbooks/roles/configure-network/tasks/main.yml index df1580e5..126389d8 100644 --- a/xci/playbooks/roles/configure-network/tasks/main.yml +++ b/xci/playbooks/roles/configure-network/tasks/main.yml @@ -7,7 +7,11 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -# TODO: this role needs to be adjusted for different distros +- name: ensure glean rules are removed + file: + path: "/etc/udev/rules.d/99-glean.rules" + state: absent + - block: - name: configure modules lineinfile: @@ -19,10 +23,6 @@ modprobe: name: 8021q state: present - - name: ensure glean rules are removed - file: - path: "/etc/udev/rules.d/99-glean.rules" - state: absent - name: ensure interfaces.d folder is empty shell: "/bin/rm -rf /etc/network/interfaces.d/*" - name: ensure interfaces file is updated @@ -32,3 +32,42 @@ - name: restart network service shell: "/sbin/ifconfig {{ interface }} 0 && /sbin/ifdown -a && /sbin/ifup -a" when: ansible_os_family | lower == "debian" + +- block: + - name: Remove existing network configuration + file: + path: "/etc/sysconfig/network/{{ item }}" + state: absent + with_items: + - "ifcfg-eth0" + - "ifroute-eth0" + + - name: Configure networking on SUSE + template: + src: "{{ ansible_os_family | lower }}/suse.interface.j2" + dest: "/etc/sysconfig/network/ifcfg-{{ item.name }}" + with_items: + - { name: "{{ interface }}" } + - { name: "{{ interface }}.10", vlan_id: 10 } + - { name: "{{ interface }}.30", vlan_id: 30 } + - { name: "{{ interface }}.20", vlan_id: 20 } + - { name: "br-mgmt", bridge_ports: "{{ interface }}.10", ip: "{{ host_info[inventory_hostname].MGMT_IP }}/22" } + - { name: "br-vxlan", bridge_ports: "{{ interface }}.30", ip: "{{ host_info[inventory_hostname].VXLAN_IP }}/22" } + - { name: "br-vlan", bridge_ports: "{{ interface }}", ip: "{{ host_info[inventory_hostname].VLAN_IP }}/24" } + - { name: "br-storage", bridge_ports: "{{ interface }}.20", ip: "{{ host_info[inventory_hostname].STORAGE_IP }}/22" } + + - name: Add postup/postdown scripts on SUSE + copy: + src: "network-config-suse" + dest: "/etc/sysconfig/network/scripts/network-config-suse" + + - name: Configure routes on SUSE + template: + src: "{{ ansible_os_family | lower }}/suse.routes.j2" + dest: "/etc/sysconfig/network/ifroute-{{ item.name }}" + with_items: + - { name: "br-vlan", gateway: "192.168.122.1", route: "default" } + + - name: restart network service + shell: "/usr/sbin/wicked ifreload all" + when: ansible_os_family | lower == "suse" diff --git a/xci/playbooks/roles/configure-network/templates/suse/suse.interface.j2 b/xci/playbooks/roles/configure-network/templates/suse/suse.interface.j2 new file mode 100644 index 00000000..ffa418d4 --- /dev/null +++ b/xci/playbooks/roles/configure-network/templates/suse/suse.interface.j2 @@ -0,0 +1,17 @@ +STARTMODE='auto' +BOOTPROTO='static' +{% if item.vlan_id is defined %} +ETHERDEVICE={{ interface }} +VLAN_ID={{ item.vlan_id }} +{% endif %} +{% if item.bridge_ports is defined %} +BRIDGE='yes' +BRIDGE_FORWARDDELAY='0' +BRIDGE_STP=off +BRIDGE_PORTS={{ item.bridge_ports }} +{% endif %} +{% if item.ip is defined %} +IPADDR={{ item.ip }} +{% endif %} +PRE_UP_SCRIPT="compat:suse:network-config-suse" +POST_DOWN_SCRIPT="compat:suse:network-config-suse" diff --git a/xci/playbooks/roles/configure-network/templates/suse/suse.routes.j2 b/xci/playbooks/roles/configure-network/templates/suse/suse.routes.j2 new file mode 100644 index 00000000..7c868447 --- /dev/null +++ b/xci/playbooks/roles/configure-network/templates/suse/suse.routes.j2 @@ -0,0 +1 @@ +{{ item.route }} {{ item.gateway }} diff --git a/xci/playbooks/roles/configure-nfs/tasks/main.yml b/xci/playbooks/roles/configure-nfs/tasks/main.yml index 51a2d43a..25e81496 100644 --- a/xci/playbooks/roles/configure-nfs/tasks/main.yml +++ b/xci/playbooks/roles/configure-nfs/tasks/main.yml @@ -43,7 +43,13 @@ with_items: - "/images *(rw,sync,no_subtree_check,no_root_squash)" - "/volumes *(rw,sync,no_subtree_check,no_root_squash)" -- name: restart ubuntu xenial NFS service + +- name: Install the NFS server package + package: + name: "{{ nfs_server_package }}" + state: latest + +- name: restart NFS service service: name: "{{ nfs_server_service }}" state: restarted diff --git a/xci/playbooks/roles/configure-nfs/vars/debian.yml b/xci/playbooks/roles/configure-nfs/vars/debian.yml index 8d3c6561..cb3b2084 100644 --- a/xci/playbooks/roles/configure-nfs/vars/debian.yml +++ b/xci/playbooks/roles/configure-nfs/vars/debian.yml @@ -7,5 +7,5 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## - +nfs_server_package: "nfs-kernel-server" nfs_server_service: "nfs-kernel-server" diff --git a/xci/playbooks/roles/configure-nfs/vars/suse.yml b/xci/playbooks/roles/configure-nfs/vars/suse.yml new file mode 100644 index 00000000..01173d8a --- /dev/null +++ b/xci/playbooks/roles/configure-nfs/vars/suse.yml @@ -0,0 +1,11 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2017 Ericsson AB 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 +############################################################################## +nfs_server_package: "nfs-kernel-server" +nfs_server_service: "nfs-server" diff --git a/xci/playbooks/roles/remove-folders/tasks/main.yml b/xci/playbooks/roles/remove-folders/tasks/main.yml index 425b8dbf..cb81dae9 100644 --- a/xci/playbooks/roles/remove-folders/tasks/main.yml +++ b/xci/playbooks/roles/remove-folders/tasks/main.yml @@ -17,5 +17,6 @@ - "{{ OPENSTACK_BIFROST_PATH }}" - "{{ OPENSTACK_OSA_PATH }}" - "{{ OPENSTACK_OSA_ETC_PATH }}" + - "{{ XCI_DEVEL_ROOT }}" - "{{ LOG_PATH }} " - "{{ OPNFV_SSH_HOST_KEYS_PATH }}" diff --git a/xci/playbooks/roles/synchronize-time/tasks/main.yml b/xci/playbooks/roles/synchronize-time/tasks/main.yml index 985c1515..cc73c447 100644 --- a/xci/playbooks/roles/synchronize-time/tasks/main.yml +++ b/xci/playbooks/roles/synchronize-time/tasks/main.yml @@ -7,16 +7,17 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -# TODO: this role needs to be adjusted for different distros -- block: - - name: restart chrony - service: - name: chrony - state: restarted - - name: synchronize time - shell: "chronyc -a 'burst 4/4' && chronyc -a makestep" - register: chrony_got_time - until: chrony_got_time.rc == 0 - retries: 5 - delay: 5 - when: ansible_distribution_release == "xenial" +- name: install chrony + package: + name: "chrony" + state: latest +- name: restart chrony + service: + name: chrony + state: restarted +- name: synchronize time + shell: "chronyc -a 'burst 4/4' && chronyc -a makestep" + register: chrony_got_time + until: chrony_got_time.rc == 0 + retries: 5 + delay: 5 diff --git a/xci/var/Suse.yml b/xci/var/Suse.yml index 9674ed2d..786a8751 100644 --- a/xci/var/Suse.yml +++ b/xci/var/Suse.yml @@ -7,5 +7,6 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -# this is placeholder and left blank intentionally to complete later on +# this is the interface the VM nodes are connected to libvirt network "default" +interface: "eth0" python_crypto_package_name: python-pycrypto diff --git a/xci/xci-deploy.sh b/xci/xci-deploy.sh index 5a01772f..19f2c18a 100755 --- a/xci/xci-deploy.sh +++ b/xci/xci-deploy.sh @@ -67,11 +67,35 @@ echo "-------------------------------------------------------------------------" #------------------------------------------------------------------------------- source file/install-ansible.sh -# There is no CentOS or openSUSE support at all -if [[ $OS_FAMILY != Debian ]]; then +# Make the VMs match the host. If we need to make this configurable +# then this logic has to be moved outside this file +case ${OS_FAMILY,,} in + # These should ideally match the CI jobs + debian) + 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}" + export EXTRA_DIB_ELEMENTS="${EXTRA_DIB_ELEMENTS:-openssh-server}" + ;; + redhat) + 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}" + export EXTRA_DIB_ELEMENTS="${EXTRA_DIB_ELEMENTS:-openssh-server}" + ;; + suse) + 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}" + export EXTRA_DIB_ELEMENTS="${EXTRA_DIB_ELEMETS:-openssh-server}" + ;; +esac + +# There is no CentOS support at all +if [[ $OS_FAMILY == RedHat ]]; then echo "" - echo "Error: Sorry, only Ubuntu hosts are supported for now!" - echo "Error: CentOS7 and openSUSE Leap support is still work in progress." + echo "Error: Sorry, only Ubuntu and SUSE hosts are supported for now!" + echo "Error: CentOS 7 support is still work in progress." echo "" exit 1 fi @@ -91,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 @@ -106,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 "-----------------------------------------------------------------------" |