Parameterize ansible version in embedded runtime

Change-Id: Ie880e10d4915c06d86084b60cbb8d994d5d9965d
This commit is contained in:
tonytan4ever 2018-10-24 14:17:45 -04:00 committed by tonytan4ever
parent 05e235859d
commit 27aeb36389
2 changed files with 4 additions and 3 deletions

View File

@ -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`.

View File

@ -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"