I'm using AWX for updating my Windows Servers. I have an inventory file with groups and hosts. For example:
[WWW]
foo.example.com
bar.example.com
foo1.example.com
bar1.example.com
[SQL]
one.example.com
two.example.com
three.example.com
In my workflow I want the servers to be booted one at the time. Now I have two templates. One for each group. Is it possible to use one template and replace the hosts variable with the group name in my workflow?
I use the same playbook for the updates, with a different variable_host.
variable_host: SQL
variable_serial: 1
In my playbook I have at the top:
hosts: "{{ variable_host | default('WWW') }}"
serial: "{{ variable_serial | default(1) | int }}"
I am looking for a solution that I don't have to make a new template for every group I have. Thanks!
You can achieve this by setting a prompt for limit and extra variables on a master patching template, then using the prompt option when adding the template to the workflow, that way you can set both the limit and the serial value per template instance added to the workflow.
Create a master template for patching.
Make sure you set the host filter to "all" (or a limit that matches all groups within the playbook), and set a variable for serial.
host: all
serial: "{{ variable_serial }}"
Now set the "PROMPT ON LAUNCH" option for both extra variables and limit on the master template and save it.