Import variables from Ansible (I improved the variable detection code)
The variables are created as smart class parameters, and they are associated to an ansible role. This means to use them in our ansible roles template, we should do something like this in our job template:
AFAIK we donāt have this for Puppet either. That nowadays has actual data types while with Ansible youād always guess (like in Puppet before version 4) so I wouldnāt prioritize this.
Iām not sure I understand the question, the format " {{ variable_name }} " can already be used instead of ā<%= host_param(āvariable_nameā) %>ā in job templates. These would be substituted by the parameter with the highest priority, like in puppet (Global > Host group > Host params).
For more context, today the template input can be fed not only by user interactively, but from fact, smart variable and smart class parameter. For the latest, one only selects the puppet class and the name of the parameter. Something similar for ansible variables would be nice.
That would be very nice to have at some point. Notice that even without template inputs, we can use Playbooks as job templates. For example a job template:
--
hosts: all
roles:
- foreman
Letās say that role āforemanā uses a variable called ādatabase_choiceā. Even without any template inputs, as long as you have ādatabase_choiceā in the list of host parameters, it will be sent as part of the inventory, so it will be used. Template Inputs in this case are only relevant when you want the user to change them before running the job.