Scheduling a job template based on host tags

Hello Everyone,

I have a job template for patching windows servers (named windowsUpdate) against a list of hosts in inventory file. I want to schedule the patching activity using AWX based on tags assigned to hosts.

for eg: Suppose i have a list of server : Server1,Server2,Server3,Server4,Server5,Server6,Server7,Server8,Server9,Server10 .

And I want to patch Server1,Server2,Server3 on every 3rd Wednesday every month and Server4, Server5 on 4th Wednesday every month. Similarly Server6 ,Server7,

Server8, Server9, Server10 on every Tuesday.

So, if i am scheduling the template windowsUpdate it will start patching every host in the inventory file. But Based on the above I want some of them to patch on every 3rd wednesday and so on…

So, Is there any way to segregate hosts such that I can schedule the playbook and it will do the update on required days and just on required hosts.

As of now i don’t see any option to do this in AWX console or don’t know.

Please If anyone have any suggestions .Please help me out on this.

Thanks in advance.

You can create a job template based on the same playbook with different limits. Then assign it to the schedule

Adding to below, try segregating your inventory to smart groups, based on days may be . . Which can be mentioned in limit of the Schedule.

https://docs.ansible.com/ansible/latest/user_guide/intro_patterns.html

Or you can Use dynamic inventory using add_host module, parametrise the hosts of playbook, pass different Extra_vars values for different Schedules.

Thanks and Regards
Mani Mohan

Hello Mani,

Thanks for your reply. Okay sure I will check on this method to schedule the job.

Thanks again.

Hello Wei-Yen,

Thanks for your reply. Surely I will check on it.

But I have one question is assigning a host with some tag and then scheduling based on host tags it is still not possible in AWX?

You can create an ansible group and put that host in that group