Interview Prep/Ansible/Roles, Collections and Galaxy

A role installed from Git is not found by `roles: [nginx]`

BeginnerTroubleshootingRoles, Collections and Galaxy
Answer

Likely causes → Without a name:, the role takes the repository name (ansible-role-nginx), so nginx does not match.

Diagnose → ansible-galaxy role list -p galaxy_roles

Fix →

# requirements.yml
roles:
  - name: nginx
    src: git+https://github.com/acme/ansible-role-nginx.git
    version: v2.3.1

Prevent → Always set name and pin version to a tag or commit in requirements.yml.

All Ansible questions Roadmap: Ansible

More on Roles, Collections and Galaxy