Ansible Tutorial · Getting Started · Lesson 2 of 20
Ansible Installation
Install Ansible on the control node and verify the setup.
Install with pip
The recommended way to install Ansible is with pip inside a virtual environment. This gives you the latest
version and avoids conflicting with system packages.
python3 -m venv ~/ansible-env
source ~/ansible-env/bin/activate
pip install ansible
On Ubuntu/Debian you can also use the system package, but it is often an older version:
sudo apt update && sudo apt install -y ansible
On macOS with Homebrew:
brew install ansible
Verify the installation
After installing, check the version and confirm it finds its default configuration:
ansible --version
The output shows the core version, the config file path, the Python interpreter and the module location.
Control node requirements
- Python 3.10+ (Ansible core 2.16+).
- Linux or macOS (Windows can only be a managed node, not a control node — use WSL).
- SSH client (
sshcommand available).
Managed node requirements
- Python 3 (Ansible copies modules written in Python and runs them on the managed node).
- An SSH server (
sshd) running. - A user account Ansible can log into (key-based auth is best).
No Ansible software is installed on managed nodes. That is the whole point of "agentless".
Pip extras
ansible on PyPI is a meta-package that installs ansible-core plus thousands of community collections.
For a leaner install that only includes built-in modules:
pip install ansible-core
You can then install individual collections as you need them with ansible-galaxy collection install.
pip install ansible && ansible --version
Output
ansible [core 2.16.3] config file = None configured module search path = ['/home/user/.ansible/plugins/modules'] ansible python module location = /home/user/ansible-env/lib/python3.12/site-packages/ansible ansible collection location = /home/user/.ansible/collections executable location = /home/user/ansible-env/bin/ansible python version = 3.12.3 jinja version = 3.1.3 libyaml = True
Run this on your computer — see “Get Started” for setup.
ansible --version | head -1
Output
ansible [core 2.16.3]
Run this on your computer — see “Get Started” for setup.
Test yourself
Can Windows be used as an Ansible control node?
Yes, nativelyYes, with WSLNo, neverOnly with Docker
Show answer
Answer: Yes, with WSL
Windows cannot be a control node natively, but you can use WSL (Windows Subsystem for Linux) to run Ansible.