Getting Started with Ansible
Wiki
09/12/2025
Getting Started with Ansible¶
Python Requirement¶
The following requires that Python3 is installed. Python 3.12 is currently what is set as a standard. Install Python and required packages with the following command:
sudo rm -f /etc/apt/sources.list.d/deadsnakes-ubuntu-ppa-noble.sources
sudo add-apt-repository -n -y ppa:deadsnakes/ppa
sudo apt update
sudo apt -y install python3.12 python3-pip python3-requests python3-pexpect python3-venv python3-passlib
Python Environment¶
Create a Python virtual environment located in /opt/python_3.12/. Use the following to create the Python environment and upgrade pip.
python3 -m venv /opt/python_3.12/
python -m pip install --upgrade pip
Activate the Python environment.¶
Activate the Python environment where we want to use Ansible in.
source /opt/python3.12/bin/activate
Install Ansible¶
pip install ansible==12.0.0 ansible-dev-tools==25.8.3 requests==2.32.5 pycdlib==1.14.0 proxmoxer==2.2.0 jmespath==1.0.1 passlib==1.7.4
Change to the Ansible work folder¶
cd /ansible/dev
Clone the Ansible repository from GitHub¶
git clone https://github.com/t3knoid/ansible.git
Create vault password file (.vault_pass.txt)¶
Create the file ~/.vault_pass.txt. Paste the vault password in this file and save it.
vi ~/.vault_pass.txt
Test Ansible¶
ansible -k all -i 127.0.0.1, -m ping
This should get the following response when successful.
127.0.0.1 | SUCCESS => {
"changed": false,
"ping": "pong"
}