As Ansible grows as solution for much of the DevOps community many partners and supported modules are hitting the community. However, all of us are being hit by a serious problem. Release Gap.
Release Gap is the difference of time between your modules being accepted into the Ansible core and the time you release a new feature or patch you want your customers to use.
At Avi we ran into this problem, and luckily Ansible has a solution. Roles. Using roles to deploy your modules helps you control your code and guarantee customers are using the latest tested modules you offer.
To do this we need to have a role structure as such.
1 2 3 4 5 6 7 8 |
role-name/ meta/ main.yml library/ module1.py module2.py module_utils/ module_util.py |
However, users will need to include the role in their playbook.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# Playbook that uses roles for modules --- - hosts: localhost connection: local roles: - role: company.sdk tasks: - name: This module does something module1: module_param1: value1 module_param2: value2 - name: This other module does something else module2: module2_param1: value1 module2_param2: value2 |
However, there are some caveats. Your module names should never be the same as modules that someone else, or core uses. In our case we stuck with avi_<module-name> for our modules.
A good way to look at the pipeline is the following.
Using this pipeline you can then import your modules into the core, but also pre-release or release modules at your own schedule and version, independent of Ansible release schedule. You can also allow users to upgrade their environments.
Users can then download your modules using the following command.
1 |
ansible-galaxy install -f company.sdk |
You can also specify version so your end users can control versions of your modules
1 |
ansible-galaxy install -f company.sdk,v1.0.0 |
The goal of this was to empower the partners, supported modules to be downloaded by customers without having to force customers to also upgrade Ansible itself which can affect other modules that are working for all playbooks.