Chapter 2. Installation and Setup

Ansible is written in Python for use on Linux/macOS/BSD systems. It can target all kinds of systems, and you generally do not need to install anything on the target systems, assuming that the Linux/macOS/BSD systems have Python installed and that Windows machines have PowerShell. So generally you will install Ansible on your workstation. Python 3.8 is recommended on the machine where you run Ansible.

Installing Ansible

All the major Linux distributions package Ansible these days, so if you work on a Linux machine, you can use your native package manager for a casual installation (although this might be an older version of Ansible). If you work on macOS, I recommend using the excellent Homebrew package manager to install Ansible:

$ brew install ansible

On any Unix/Linux/macOS machine, you can install Ansible using one of the Python package managers. This way you can add Python-based tools and libraries that work for you, provided you add ~/.local/bin to your PATH shell variable. If you want to work with Ansible Tower or AWX, then you should install the same version of ansible-core on your workstation.

$ pip3 install --user ansible==2.9.27

Using pip3 to install a version above 2.10 (e.g., 5.9.0) installs all standard collections as well. It’s still “batteries included.”

Note

If you work on multiple projects, you should install Ansible into a Python virtualenv. This lets you avoid interfering with your system Python or cluttering your user environment. ...

Get Ansible: Up and Running, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.