Just finished working on my first ansible modules. Searched around to find out if I can assign a version number to the ansible modules . Couldn’t find anything.
Can I assign a version number to a module? So if someone finds a bug in my version I can tell them just upgrade to version
Plan on using git tags on the github repo for the modules.
Is this the right way to do it? So no need to worry about applying a version number within the ansible modules
I had been toying with an idea and I just ran some tests for this which seem to work just fine:
Add your module to ansible galaxy (put the module in a “library” folder). Don’t add any tasks.
That way, your users can retrieve and update the module through the ansible-galaxy command instead of cloning, and you get versioning for free because ansible galaxy respects the version tag of the repo.
Using the module is then just a case of adding the “module-role” before the “module-usage-task”
Ansible modules that ship with Ansible do have versions in the docs - they indicate the version they are shipped with and the version of each new parameter.
When Ansible ships, the modules get updated.
For your own modules, if you wish to share them, keeping them like that on Galaxy can be a good idea.
If you are doing something in house, we recommend a roles repo with version control branches.