3

Currently building multiple Ansible roles for my company some of which will be marked as dependant on one another(think like a deploy [application] containers role thats dependant on the role docker to be installed).

We run our automated tests through molecule However, since we have our own on-premise source control and uploading these roles to ansible-galaxy isn't an option i'd like to be able to run the automated tests for the dependent roles as well which would require them to be imported. Documentation of molecule shows that there is an alternate dependency manager named Gilt.

Documentation on this further though is non-existent and I am wondering if anybody has an example of how to flag this role as being dependant on another so that it gets imported during the molecule test run. An important note here is that the private repos are not open to being cloned, Azure DevOps on premise 2019 does not allow any repository to be set to "Public" so even a clone will require authentication

Sefiris
  • 31
  • 1

2 Answers2

0

Role dependencies are set in role/meta/main.yml. With a bit of work you could fork all the roles you need into a private Git server. The ansible-galaxy install -r roles/requirents.yml -p roles works fine if the roles you need have a git url and you can event change the names in requirements.yml to match their online counterparts.

bbaassssiiee
  • 6,013
  • 2
  • 42
  • 55
  • You've misunderstood the question, the problem is not public ansible galaxy roles but private ones that are being hosted on premise, behind authentication. its been more than a year since I've even touched this however I'm quite sure i remember that defining anything in meta/main.yml will make molecule attempt to import them from ansible galaxy with no documentation anywhere to make it search elsewhere. the ansible-galaxy cli might work fine doing this, but the question was how to get molecule the testing engine to do it as well. – Sefiris Sep 11 '21 at 17:04
  • I believe you should be able to set `provisioner:env:ANSIBLE_ROLES_PATH: "../../roles"` in `molecule.yaml` – Dzintars Dec 14 '21 at 16:47
0

You could run the new Automation Hub and configure ansible to use that https://www.ansible.com/blog/getting-started-with-automation-hub

bbaassssiiee
  • 6,013
  • 2
  • 42
  • 55