From 27aeb36389bac9c63ed34f0ed54e99aed02918b6 Mon Sep 17 00:00:00 2001 From: tonytan4ever Date: Wed, 24 Oct 2018 14:17:45 -0400 Subject: [PATCH] Parameterize ansible version in embedded runtime Change-Id: Ie880e10d4915c06d86084b60cbb8d994d5d9965d --- bootstrap-embedded-ansible/README.rst | 2 +- bootstrap-embedded-ansible/bootstrap-embedded-ansible.sh | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bootstrap-embedded-ansible/README.rst b/bootstrap-embedded-ansible/README.rst index 321b2b13..18ade5b5 100644 --- a/bootstrap-embedded-ansible/README.rst +++ b/bootstrap-embedded-ansible/README.rst @@ -20,6 +20,6 @@ Usage With the script sourced, the ansible enviornment will create a virtual environment at -`${HOME}/ansible25` if it does not already exist. +`${HOME}/ansible${ANSIBLE_VERSION}` if it does not already exist. To leave the embedded ansible enviornment run the function `deactivate`. diff --git a/bootstrap-embedded-ansible/bootstrap-embedded-ansible.sh b/bootstrap-embedded-ansible/bootstrap-embedded-ansible.sh index 50c30988..18f49267 100755 --- a/bootstrap-embedded-ansible/bootstrap-embedded-ansible.sh +++ b/bootstrap-embedded-ansible/bootstrap-embedded-ansible.sh @@ -14,7 +14,8 @@ # limitations under the License. export OPTS=() -export ANSIBLE_EMBED_HOME="${HOME}/ansible25" +export ANSIBLE_VERSION="${ANSIBLE_VERSION:-2.5.5.0}" +export ANSIBLE_EMBED_HOME="${HOME}/ansible${ANSIBLE_VERSION}" OPTS+=('ANSIBLE_EMBED_HOME') source /etc/os-release @@ -39,7 +40,7 @@ if [[ ! -e "${ANSIBLE_EMBED_HOME}/bin/ansible" ]]; then virtualenv "${ANSIBLE_EMBED_HOME}" fi eval "${ANSIBLE_EMBED_HOME}/bin/pip install --upgrade --force pip" - eval "${ANSIBLE_EMBED_HOME}/bin/pip install --upgrade ansible==2.5.5.0 --isolated" + eval "${ANSIBLE_EMBED_HOME}/bin/pip install --upgrade ansible==${ANSIBLE_VERSION} --isolated" eval "${ANSIBLE_EMBED_HOME}/bin/pip install --upgrade jmespath --isolated" eval "${ANSIBLE_EMBED_HOME}/bin/pip install --upgrade hvac --isolated" eval "${ANSIBLE_EMBED_HOME}/bin/pip install --upgrade netaddr --isolated"