My team maintains about ~60 Ansible roles internally and for reasons I won’t get into, we are just now upgrading to Ansible 2.15 from 2.10.
This upgrade gives us the ability to leverage argument_specs, which I think is going to be essential for our CI plans since it gives us a way to contract test our roles. The current plan is to go back and update all of our roles with said argument_specs - which is definitely a lot of work.
My question - is anyone aware of a tool that can scrape an Ansible role’s default vars and generate at least a partial argument_specs.yml? If not, i’m thinking we may develop something like this.
In my company we do something similar but for readme of the role.
We scarpe the role and we add variable with respective comment in a table of readme.
For required variable we also scrape the yml file and we check the assert /fail module to understand what is mandatory.
I thinking to add/migrate also our roles to argument_spec and also to use the “auto” asseriton but (there is a but ) this is very poor in terms of asseriton and control.
Code is internal and I can’t share it, but is very simple python that load default file and read lines with comment and for assert/fail load it as a pure yaml.
I open a issue with PR on ansible side to start some “rework” on argument_spec in a way to enfocer strict object. I think that in this way this features will be come very, very usefull.
Follow it and if you think that will help you!!