Installing Ansible
As mentioned already, if you are using the lab environment provided in the book, you can skip this step. But if you want to install Ansible on your own, these are the steps to get it done.
We should install Ansible on a Unix-like machine (this is known as the Ansible control machine). In this recipe, we will outline how to install Ansible on an Ubuntu Linux machine (specifically, with version 22.04).
Ansible is written in Python, so you must have Python installed on your system. Most OSs nowadays come with Python pre-installed, but follow the next steps to validate and finalize the Python install. Lastly, you will install python3-venv, which allows you to create multiple Python environments and keep different dependencies installed (a best practice):
- Install Python 3 and Python 3
virtualenv:root@cookbook-lab:~/cookbook-lab/chapters/ch02# sudo apt install python3.11 python3.11-venv - Validate the Python 3 installation: ...