I am at trying to create ansible AWX workflow, when I attach a job template having survey variable defined, at start of the workflow, it ask me to input those variables and makes me saves it.
When I run the workflow, it takes only those saved values and not the new value to be asked during job run
Is there a way I can prompt survey to user on different job template attached on a workflow ?
From my experience, you will need to have the survey on the workflow for it prompt on launch. We have a few operations where we want to use a job template with a survey both by itself or within a workflow. The way we get around this is to have the job template survey questions as optional so we don’t need to save responses when attaching to a workflow. This does mean that you have to maintain 2 surveys but we’ve found that we usually need different survey questions on the workflow as compared to those in the job template.
You can manage surveys via the API and, in theory, could keep the surveys in sync via another playbook but that will probably not be worth the effort if the surveys are simple or don’t change that often.
I want to create a workflow which does these things -
Template1 : Gather server instance information (from openstack) created by the user running the ansible job.
-Template2: Display the output of 1st template on survey (multiple choice single select) and from here, if user selects one instance, perform patching on that (or any other operation)
Note: I am able to create dynamic inventory for template2 and able to use API too, but cannot create workflow out of it.
I’ve wanted to do something similar in the past but unfortunately, AWX doesn’t support dynamic surveys and starts to crossover into more of UI design then what I think surveys were originally designed for. All values in single/multiple select fields are statically defined. You could update these fields via the API then have the user run another template but it will change the survey permanently for everyone on each run and probably not what I think you’re looking for.
Also, there is limited ability to prompt users during a workflow run. I think of them as an easy way to chain templates together and you do run into blockers when you try to do too much logic/conditionals outside of the playbook.
Are you finding that your users don’t know the host name they are targeting or is there a high chance for typos in the host names? Asking as it seems that the dynamic inventory plugin would be my first choice (minus the survey requirement).