Skip to content

Commit

Permalink
Fix CentOS Ansible bootstrap
Browse files Browse the repository at this point in the history
This patch implements the following fixes to the bootstrap-ansible
script in order to make it work successfully on CentOS7:

 - Remove yum check-update as it returns 0 only when no updates are
   available.
 - Add a variable to adjust the virtualenv CLI based on the distro
   used as '--always-copy' does not work on CentOS.


Change-Id: Ia591c3558bd00945dc3076ed19d4c6e364bec939
  • Loading branch information
mgariepy authored and Jesse Pretorius (odyssey4me) committed Sep 27, 2016
1 parent 195b505 commit ee40a8a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/bootstrap-ansible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export SSH_DIR=${SSH_DIR:-"/root/.ssh"}
export DEBIAN_FRONTEND=${DEBIAN_FRONTEND:-"noninteractive"}
# Set the role fetch mode to any option [galaxy, git-clone]
export ANSIBLE_ROLE_FETCH_MODE=${ANSIBLE_ROLE_FETCH_MODE:-galaxy}
# virtualenv vars
VIRTUALENV_OPTIONS="--always-copy"

# This script should be executed from the root directory of the cloned repo
cd "$(dirname "${0}")/.."
Expand All @@ -51,12 +53,12 @@ determine_distro
# Install the base packages
case ${DISTRO_ID} in
centos|rhel)
yum check-update
yum -y install git python2 curl autoconf gcc-c++ \
python2-devel gcc libffi-devel nc openssl-devel python-requests \
python2-devel gcc libffi-devel nc openssl-devel \
python-pyasn1 pyOpenSSL python-ndg_httpsclient \
python-netaddr python-prettytable python-crypto PyYAML \
python-virtualenv
VIRTUALENV_OPTIONS=""
;;
ubuntu)
apt-get update
Expand Down Expand Up @@ -88,7 +90,7 @@ fi

# Create a Virtualenv for the Ansible runtime
PYTHON_EXEC_PATH="$(which python2 || which python)"
virtualenv --clear --always-copy --system-site-packages --python="${PYTHON_EXEC_PATH}" /opt/ansible-runtime
virtualenv --clear ${VIRTUALENV_OPTIONS} --system-site-packages --python="${PYTHON_EXEC_PATH}" /opt/ansible-runtime

# Install ansible
PIP_OPTS+=" --upgrade"
Expand Down

0 comments on commit ee40a8a

Please sign in to comment.