Hi,
I’ve been using ansible for quite a while and have lots of playbooks that I run from the command line. I have an inventory with several groups in it. When I run a playbook I can tell it to run against a single host, or an inventory group, or a host pattern, or any combination thereof. So I might use this technique to run a playbook against a test server first, then the UAT group, and later the PROD group.
Now I’m trying to move my work into AWX, and have imported my inventory and playbooks using a git source.
I found a way to select an inventory group and then “Run Command” against that group which is OK for ad-hoc stuff, but there doesn’t seem to be a way I can run playbooks against an inventory group.
Does anyone know if this is possible?
The closest I got is by using a survey in my template - and ask what hosts to run against, and feed the answer through to a variable which I pass into the hosts: statement.
This does work but I have to manually code every possible answer for a multiple choice question, which means I’ll have to modify all my surveys every time I add or change an inventory group.
The other option is a text answer to the survey but that means I have to validate every answer in my playbook somehow.
What I would like to do is have a survey that asks what group to run against, and automatically shows a list of groups in the active inventory - I know AWX can do this because it does it in the inventory hosts tab - but I would like to have this functionality in a survey.
Does anyone know if that can be done?
I also tried using “Limit” but that works on a host pattern and not all my groupings can be achieved with a host pattern - I just want to use the groups as already defined in the inventory.