Reference Run Multiple Ansible Versions Side by Side Using Python 3 Virtual Environments
Last active
December 7, 2020 20:30
-
-
Save aspen-roller/db6c42648bfa71bff948ebbb2e809e73 to your computer and use it in GitHub Desktop.
python venv for ansible testing #ansible #python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# colorize molecule test outputs | |
export PY_COLORS=1 | |
# encrypted variables | |
export ANSIBLE_VAULT_PASSWORD_FILE=~/.ansible/.vault_password |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scp zscaler.crt user@remote:/tmp | |
ssh user@remote | |
sudo mv /tmp/zscaler.crt /usr/local/share/ca-certificates | |
sudo update-ca-certificates |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run setup-zscaler.sh first | |
# set the vault password (sadevopstovault's password) | |
mkdir ~/.ansible | |
echo 'xxx' > ~/.ansible/.vault_password | |
chmod 600 ~/.ansible/.vault_password | |
sudo apt-get update | |
# Ubuntu 20.04 | |
sudo apt-get install python3-venv | |
# Ubuntu 18.04 | |
sudo apt-get install python3-pip python3-venv | |
cd | |
mkdir python-env | |
cd python-env | |
# make an environment for ansible-2.9.x | |
python3 -m venv ansible-2.9 | |
# switch to the new environment | |
source ansible-2.9/bin/activate | |
pip install --upgrade pip | |
pip config --site set global.cert /usr/local/share/ca-certificates/zscaler.crt | |
pip install --upgrade setuptools wheel | |
# if the upgrade fails add the following | |
pip config --site set global.trusted-host 'pypi.org files.pythonhosted.org' | |
# install ansible and related tools | |
pip --timeout 1000 install ansible[azure]==2.9.15 ansible-lint hvac[parser] jmespath molecule[docker] yamllint | |
# exit the environment | |
deactivate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment