Test dependant Ansible roles with molecule and gilt, zero documentation

Viewed 264

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

2 Answers

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.

Related