AWX : Select Instance group Workflow template

How can we select the instance group while triggering the workflow template. We have the option to select the inventory, but we have a requirement to select the instance group while executing workflow template.

You can define this in Job Templates, and can check the box to “Prompt on Launch” for them.

In Workflow Templates, it doesn’t prompt for this at the workflow level, but you can answer the Instance Group for each Job Template node in the Workflow that prompts for it. This would be a static configuration, so you can’t prompt for it at the workflow’s runtime, but I don’t exactly know why you would want to either.

At first glance it does appear to be a unique requirement but as an example, I could see remote execution nodes which are intended for jobs/work on other specific servers/appliances.

For instance, you may have some job templates which operate on specific network appliances/devices and have that access gated by some subnet/firewall where said action can be performed. In this case, one or more execution nodes running in that subnet can be bastion nodes to perform that work and can be used in the job template and called via the OP’s workflow.

Maybe not the best example but it’s really the only thing I could think which would make sense.

1 Like

That’s a perfectly reasonable scenario for Instance Groups and having them be dynamically assignable to Job Templates. I still don’t see why a Workflow Template itself should need to. You can place multiple job templates, including multiple occurrences the same one, using various/different instance groups in a workflow.

The same workflow can handle jobs run against Network A, B, and C all at the same time. If you want the workflow to only run against Network A, B, or C, then you would need to limit your inventory to that network. Changing Instance Groups on the fly wouldn’t make sense since there’s a hard dependency on which network works with which Instance Group.

2 Likes

sirjaren explained the scenario which we have encountered. We have thousands of servers with restrictions on networks. Lets assume we have 2 instance group named IG-A and IG-B and 4 inventories. Here 2 inventories can be executed while selecting IG-A as the instance group and the remaining 2 by selecting IG-B. If its vice versa then the execution fails with connectivity issue. Also our work flow template has 40+ job templates within it. So having a prompt on launch option for selecting the instance group similar to inventory would be helpful to execute the scenario.

Since your workflow is so large, I think the easiest thing for you to do is assign the appropriate Instance Group directly to your inventory. Then you can run your 40+ node Workflow against any inventory you like, and it will use the appropriate pool of execution nodes.

Thanks @Denney-tech above suggested method worked. I was able to trigger the entire workflow against the expected instance group.

1 Like