A wrapper for ansible-galaxy that allows you to define role dependencies inside a requirements.yml
Molecule Ansible Galaxy Wrapper
An Ansible Galaxy wrapper to serve as a molecule dependency plugin with intra-dependencies support.
Imagine the scenario, you have a Role named
child that depends on a role called
parent depends on
child you need to have
grandparent in your
child -> parent -> grandparent
Ansible Galaxy is smart enough to figure that out, all you have to do is define
grandparent as a dependency of
parent role inside
meta/main.yml and then
parent as a dependency inside
The problem is that molecule enforces tracking role dependencies inside a
requirements.yml file, in that case, you have two options:
- Include both
requirements.ymland simply ignore
requirements.ymland duplicate the same content inside
First approach might look reasonable in a scenarion like this, but you might have a more complex dependency relationship and in that case you will soon have big problems.
The latter looks ugly but at least you can delegate the responsability of figuring out the dependency tree to Ansible Galaxy.
Enter the Dirty Hack
At some point we will forget to append dependencies to both
meta/main.yml. To avoid this issue I've created this tiny wrapper that does basically two things:
- Copy the content of
pip install molecule-galaxy-wrapper
molecule.yml to use the warpper:
dependency: name: shell command: galaxywrapper driver: name: docker ...
Test it by running:
Now you can maintain role dependencies inside your
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size molecule_galaxy_wrapper-0.0.4-py3-none-any.whl (9.1 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size molecule-galaxy-wrapper-0.0.4.tar.gz (3.6 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for molecule_galaxy_wrapper-0.0.4-py3-none-any.whl
Hashes for molecule-galaxy-wrapper-0.0.4.tar.gz