xci: Decouple VM distribution from host OS 25/49725/2
authorMarkos Chandras <mchandras@suse.de>
Thu, 28 Dec 2017 12:00:08 +0000 (12:00 +0000)
committerMarkos Chandras <mchandras@suse.de>
Wed, 3 Jan 2018 09:53:02 +0000 (09:53 +0000)
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 <mchandras@suse.de>
xci/config/user-vars
xci/nfvi/osa/nfvi-deploy.sh
xci/var/opnfv.yml
xci/xci-deploy.sh

index 2d1743a..da3528f 100755 (executable)
@@ -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}
 
index 14577dd..9546215 100755 (executable)
@@ -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\""
index d3f6bf3..70c80da 100644 (file)
@@ -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') }}"
index fa03ef8..e0b31ab 100755 (executable)
@@ -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."