Hi there,
I'm currently using the in-development 1.8 version of Ansible to get access to the enhanced requirements.yml features for the ansible-galaxy command line tool. I'm using it to install roles from GitHub with the appropriate config, and for the most part everything is working OK. However, a few times I've ran into issues working with roles I've created that have meta/main.yml dependencies specified.
Until about an hour ago, when setting up a test case to replicate the problem I am running into, I wasn't aware of the comment that is generated in meta/main.yml when you do ansible-galaxy init – " # List your role dependencies here, one per line. Only dependencies available via galaxy should be listed here. Be sure to remove the '[]' above if you add dependencies to this list."
Is that a hard rule, that you can't add dependencies via the meta/main.yml workflow? I've actually been structuring some of my roles around the functionality of adding a dependency in another role and specifying variables, unaware that meta/main.yml dependencies are only for galaxy resolution. I'd just like some clarification on this, and maybe thoughts around an alternative workflow if I shouldn't be using role dependencies this way.
The problem I encountered before discovering this was that ansible-galaxy would fail to install roles from the requirements.yml if they had a meta/main.yml dependency specified that wasn't from galaxy – I guess I had been relying on what was on the local filesystem and what the tool downloaded.
An example of how some of my dependencies are being used (this is from a role to install nodejs, calling another role I've created to manage apt repos):
dependencies:
- role: apt
apt_repo:
- repo_url: "deb https://deb.nodesource.com/node {{ ansible_distribution_release }} main"
key_id: "68576280"
key_url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
Let me know if I wasn't clear enough or you have any questions. Any feedback would be greatly appreciated.
Thanks for your time.