- Target Ansible version ≥ 2.7
- Official Documentation
- Explore a couple approaches using:
- OS package manager
- Python package manager (pip)
- Ansible < 2.5 require Python 2.7
- support for Python 3 considered tech preview
- Ansible ≥ 2.5 supports Python 2.7 and Python ≥ 3.5
- Ansible available with OS typically a bit out of date
- Generally necessary to add source repo (apt, yum, etc.)
- Other method is to set up a Python virtual environment
- Advantage of this technique: multiple separate ansible environments
- Different needs for different projects
- Generally possible with both Python2 and Python3
- We'll assume Python3
- Install python requirements
sudo apt-get install python3-pip virtualenv
- Set up local Python environment
virtualenv -p /usr/bin/python3 ~/venv
-
Activate virtualenv as base of Python interpreter
source ~/venv/bin/activate
-
Update Python package manager (pip)
pip install -U pip
-
Use Python package manager to install Ansible
pip install ansible
- Install some tools that we'll need for the cloud
pip install openstacksdk dnspython
pip install python-{openstackclient,ceilometerclient,heatclient,neutronclient,swiftclient,octaviaclient,magnumclient}
- It is worth keeping up to date with Ansible releases
- Use pip or a PPA to get a recent version
- Ansible is developed and released on a flexible 4 months release cycle
- Ansible supports the two most recent major stable releases