Choose Your Install Method
| Method | When to pick it | Version freshness |
|---|---|---|
pip install ansible | Recommended for everyone — works on every OS | Latest stable |
dnf install ansible (OEL 8) | You want one-line install, OS-managed | Often a few minor versions behind |
brew install ansible (macOS) | You're on a Mac and already use Homebrew | Latest stable |
| From source (git) | Contributing to Ansible itself | Bleeding edge |
💡 Note: Ansible is just Python — it does not need to be installed on the managed nodes. Only the control node needs it. Managed nodes only need Python 3 (already present on OEL 8).
Method 1 — pip on OEL 8 (Recommended)
BASH — pip install on OEL 8
# 1. install Python 3 + pip if not already present
sudo dnf install -y python3 python3-pip
# 2. install Ansible into your user site (no root needed)
pip3 install --user ansible
# 3. add user-pip's bin to PATH (one time)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# 4. verify
ansible --version
You should see something like:
OUTPUT — ansible --version
ansible [core 2.16.x]
config file = None
configured module search path = ['/home/deploy/.ansible/plugins/modules', ...]
ansible python module location = /home/deploy/.local/lib/python3.9/site-packages/ansible
python version = 3.9.16 (main, Jul ...) [GCC 8.5.0 20210514 (Red Hat 8.5.0-22)]
Method 2 — dnf on OEL 8 (One-Liner)
BASH — dnf install on OEL 8
# Ansible lives in the EPEL repo for OEL 8
sudo dnf install -y oracle-epel-release-el8
sudo dnf install -y ansible-core
# Verify
ansible --version
⚠ Warning: The dnf-packaged version is usually 6–18 months behind the latest pip release. For production-critical work — especially anything touching the
community.mysql or community.postgresql collections — prefer pip so you get current modules. Method 3 — Homebrew on macOS
BASH — Homebrew install on macOS
# Homebrew bundles a current Python and Ansible
brew install ansible
# Verify
ansible --version
ansible vs ansible-core — Which Should I Install?
There are two packages on PyPI: ansible-core (the engine + a tiny set of
built-in modules) and ansible (which is ansible-core + ~100 community
collections pre-bundled).
| Package | What it bundles | Pick when |
|---|---|---|
ansible-core | Engine + ansible.builtin.* only | You want a slim install and will pull collections via ansible-galaxy as needed |
ansible | Engine + ~100 collections (community.mysql, community.postgresql, ansible.posix, …) | You want batteries included for typical infra work |
💡 Tip: For this database-focused series we recommend
pip3 install --user ansible (the bundled one) so you immediately have community.mysql, community.postgresql, and ansible.posix available without an extra install step. Quick Sanity Check
BASH — Sanity check
# Show ansible version and Python it's using
ansible --version
# Show all installed collections
ansible-galaxy collection list
# Run a no-op against localhost
ansible localhost -m ansible.builtin.ping
✅ Tip: If
ping returns SUCCESS => pong against localhost you're done — control node is ready. Next page: setting up SSH keys to managed nodes.