Due to policies, I cannot upload company code to Galaxy. I am trying to use git roles to work around this.
I based my approach off this answer, and by referencing the doco here.
All the Ansible code is in two repositories, a company-shared repo (acme), and an app-specific repo (simpleapp).
When I run the playbook from simpleapp, it errors out, stating it can't find the shared role in acme, but looking in the cache dir, it seem to download both repositories.
This is a stripped-down version, just trying to call the shared debug role:
$ tree acme/
acme/
├── README.md
└── roles
└── users
├── defaults
│ └── main.yml
├── meta
│ └── main.yml
└── tasks
└── main.yml
5 directories, 4 files
$ tree simpleapp/
simpleapp/
├── README.md
├── playbooks
│ └── run_debug.yml
└── roles
└── requirements.yml
2 directories, 3 files
$ cat acme/roles/users/meta/main.yml
---
galaxy_info:
author: Werner van der Merwe
company: ICS
license: MIT
min_ansible_version: '2.0'
role_name: 'users'
description: Create shared users
$ cat simpleapp/roles/requirements.yml
- src: https://REDACTED
scm: git
version: main
name: acme
$ cat simpleapp/playbooks/run_debug.yml
---
- name: Playbooks that calls a role from the shared repo
hosts: all
gather_facts: false
roles:
- role: acme.users
The error I get in the AWX console:
ERROR! the role 'acme.users' was not found in /runner/project/playbooks/roles:/runner/requirements_roles:/runner/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/runner/project/playbooks
Any assistance will be greatly appreciated.
Thanks to the AWX user group, I have found my error. When reaching out to roles, only one role per repo is considered.
The solution is to create a collection (rather than a role), to serve multiple roles.