Ansible - Extra Variables in Tower
by
Jeremy Canfield |
Updated: February 16 2023
| Ansible articles
Following are the differet ways that variables can be set in Ansible. This list is in the order of precedence, where the option higher in the list takes precedence over options lower in the list.
- --extra-vars command line option or Extra Variables in Tower
- set_fact module
- include_vars module
- vars_prompt
- vars_files plugin
- vars plugin
- roles vars
- group_vars
- /etc/ansible/hosts or your own inventory file
- lookup vars plugin
- register parameter and debug module
If you are not familiar with extra variables, refer to Ansible - --extra-vars (variables) command line option.
Extra variables can be defined a various places in Tower, such as in a Job Template, in Inventory, or in a Credentials Store.
From the Templates view:
- In the left panel of Ansible Tower, select Templates.
- Select the green plus icon.
- Select Job Template.
From a Project:
- In the left panel of Ansible Tower, select Project.
- Select the Project that you want to associate with the Job Template.
- Select the Job Templates button.
- Select the green plus icon.
- Select Job Template.
In this example, two extra variables have been defined, using the YAML format. This would be the equivelant of using the --extra-vars command line option.
Did you find this article helpful?
If so, consider buying me a coffee over at