diff --git a/scripts/bootstrap-ansible.sh b/scripts/bootstrap-ansible.sh index aedf073065..f41c175f9a 100755 --- a/scripts/bootstrap-ansible.sh +++ b/scripts/bootstrap-ansible.sh @@ -43,14 +43,21 @@ ANSIBLE_ROLE_FILE="$(readlink -f ${ANSIBLE_ROLE_FILE})" # Create the ssh dir if needed ssh_key_create +# Determine the distribution which the host is running on +determine_distro + # Install the base packages -if [[ -f "/etc/os-release" ]]; then - apt-get update && apt-get -y install git python-all python-dev curl python2.7-dev build-essential libssl-dev libffi-dev python-requests < /dev/null -elif [[ -f "/etc/redhat-release" ]]; then - yum check-update && yum -y install git python2 curl autoconf gcc-c++ python2-devel gcc libffi-devel openssl-devel python-requests -elif [[ -f "/etc/fedora-release" ]]; then - dnf -y install git python curl autoconf gcc-c++ python-devel gcc libffi-devel openssl-devel python-requests -fi +case ${DISTRO_ID} in + centos|rhel) + yum check-update && yum -y install git python2 curl autoconf gcc-c++ python2-devel gcc libffi-devel openssl-devel python-requests + ;; + fedora) + dnf --refresh -y install git python curl autoconf gcc-c++ python-devel gcc libffi-devel openssl-devel python-requests + ;; + ubuntu) + apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install git python-all python-dev curl python2.7-dev build-essential libssl-dev libffi-dev python-requests + ;; +esac # Install pip get_pip diff --git a/scripts/scripts-library.sh b/scripts/scripts-library.sh index 361e5918b5..0a8d9b5e6b 100755 --- a/scripts/scripts-library.sh +++ b/scripts/scripts-library.sh @@ -41,6 +41,15 @@ fi ## Functions ----------------------------------------------------------------- +# Determine the distribution we are running on, so that we can configure it +# appropriately. +function determine_distro { + source /etc/os-release 2>/dev/null + export DISTRO_ID="${ID}" + export DISTRO_NAME="${NAME}" + export DISTRO_VERSION_ID="${VERSION_ID}" +} + # Used to retry a process that may fail due to random issues. function successerator { set +e