From d3116e3182ebae9d40544060a0318cbc382e388c Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Thu, 28 Dec 2017 12:00:08 +0000 Subject: xci: Decouple VM distribution from host OS Introduce a new XCI_DISTRO variable to select the distribution to deploy on the VMs in order to make deployments more flexible and decouple the VM OS selection from the host one. The default value for this new variable is to match the host OS but users can always set it to one of the supported distributions. We can now simply execute the install-ansible.sh script instead of sourcing it in order to keep the environment as clean as possible. Change-Id: Ia74eb0422f983848cde0fb7b220ea1035dfa78bc Signed-off-by: Markos Chandras --- xci/config/user-vars | 1 + xci/nfvi/osa/nfvi-deploy.sh | 2 +- xci/var/opnfv.yml | 1 + xci/xci-deploy.sh | 14 ++++++-------- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/xci/config/user-vars b/xci/config/user-vars index 2d1743a2..da3528f4 100755 --- a/xci/config/user-vars +++ b/xci/config/user-vars @@ -21,6 +21,7 @@ # export XCI_FLAVOR="ha" #------------------------------------------------------------------------------- export XCI_FLAVOR=${XCI_FLAVOR:-aio} +export XCI_DISTRO=${XCI_DISTRO:-$(source /etc/os-release &>/dev/null || source /usr/lib/os-release &>/dev/null; echo ${ID,,})} export XCI_CEPH_ENABLED=${XCI_CEPH_ENABLED:-false} export XCI_NFVI=${XCI_NFVI:-osa} diff --git a/xci/nfvi/osa/nfvi-deploy.sh b/xci/nfvi/osa/nfvi-deploy.sh index 14577dd5..95462150 100755 --- a/xci/nfvi/osa/nfvi-deploy.sh +++ b/xci/nfvi/osa/nfvi-deploy.sh @@ -139,7 +139,7 @@ fi echo "Info: Verifying database cluster" echo "-----------------------------------------------------------------------" # Apply SUSE fix until https://review.openstack.org/508154 is merged -if [[ ${OS_FAMILY,,} == "suse" ]]; then +if [[ ${XCI_DISTRO,,} == "opensuse" ]]; then ssh root@$OPNFV_HOST_IP "set -o pipefail; ansible --ssh-extra-args='-o StrictHostKeyChecking=no' \ -i releng-xci/.cache/repos/openstack-ansible/playbooks/inventory/ galera_container -m shell \ -a \"sed -i \\\"s@/var/run/mysqld/mysqld.sock@/var/run/mysql/mysql.sock@\\\" /etc/my.cnf\"" diff --git a/xci/var/opnfv.yml b/xci/var/opnfv.yml index d3f6bf31..70c80da0 100644 --- a/xci/var/opnfv.yml +++ b/xci/var/opnfv.yml @@ -21,6 +21,7 @@ OPENSTACK_OSA_ETC_PATH: "{{ lookup('env','OPENSTACK_OSA_ETC_PATH') }}" XCI_ANSIBLE_PIP_VERSION: "{{ lookup('env','XCI_ANSIBLE_PIP_VERSION') }}" XCI_CACHE: "{{ lookup('env', 'XCI_CACHE') }}" XCI_FLAVOR: "{{ lookup('env','XCI_FLAVOR') }}" +XCI_DISTRO: "{{ lookup('env', 'XCI_DISTRO') }}" XCI_FLAVOR_ANSIBLE_FILE_PATH: "{{ lookup('env','XCI_FLAVOR_ANSIBLE_FILE_PATH') }}" XCI_LOOP: "{{ lookup('env','XCI_LOOP') }}" XCI_PATH: "{{ lookup('env', 'XCI_PATH') }}" diff --git a/xci/xci-deploy.sh b/xci/xci-deploy.sh index fa03ef8d..e0b31ab9 100755 --- a/xci/xci-deploy.sh +++ b/xci/xci-deploy.sh @@ -99,24 +99,22 @@ echo "-------------------------------------------------------------------------" #------------------------------------------------------------------------------- echo "Info: Installing Ansible from pip" echo "-------------------------------------------------------------------------" -source files/install-ansible.sh +bash files/install-ansible.sh echo "-------------------------------------------------------------------------" -# 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 +case ${XCI_DISTRO,,} in # These should ideally match the CI jobs - debian) + 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}" ;; - redhat) + 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}" ;; - suse) + 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}" @@ -124,7 +122,7 @@ case ${OS_FAMILY,,} in esac # There is no CentOS support at all -if [[ $OS_FAMILY == RedHat ]]; then +if [[ ${XCI_DISTRO,,} == centos ]]; then echo "" echo "Error: Sorry, only Ubuntu and SUSE hosts are supported for now!" echo "Error: CentOS 7 support is still work in progress." -- cgit 1.2.3-korg