Installing Ansible Roles from Galaxy
Galaxy has a role for most things and installing one is a single command. Trusting it is the harder part. This installs a widely used role, reads it before running it, pins it in a `requirements.yml` - and then runs it and watches it fail, because the package it wants no longer exists on this distribution. The fix is two variables and no changes to the role.
Roles and Collections Guide 27 of 45 Intermediate
- OSUbuntu 26.04 LTS
- ansible-core2.20.1
- Python3.14.4
- TimeAbout 18 min
- Reviewed23 August 2026
Written against the versions above. `ansible-galaxy role install` and `ansible-galaxy collection install` read the same `requirements.yml` but only their own section of it, and they install to different places. A `-p` path that is not on the configured search path draws a warning and the content will not be found at run time unless it sits beside the playbook.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| ANS-CTL01 | 192.168.0.36 | Ubuntu 26.04 LTS | Ansible Control Node | 2 Core | 3 GB | 50 GB |
| ANS-A01 | 192.168.0.37 | Ubuntu 26.04 LTS | Managed Node (group: web) | 2 Core | 3 GB | 50 GB |
| ANS-B01 | 192.168.0.38 | Ubuntu 26.04 LTS | Managed Node (group: db) | 2 Core | 3 GB | 50 GB |
Before you start
- A control node with network access to galaxy.ansible.com.
- The session installs
geerlingguy.ntpinto~/pb/roles/and applies it toans-b01, which ends with chrony running and the timezone set.
-
The configuration this guide assumes
-
Installing one role
-
Reading a role before you trust it
-
A requirements file
-
Where things landed
-
It installs, and it still fails
-
A role can claim a platform and still fail on it
-
Override what the role guessed