Dynamic lists for a Tower Survey

Is there any way I get a dynamic list created for a Tower survey?
I have found a hack - Quick dynamic options hack by ooasis · Pull Request #1408 · ansible/awx · GitHub but this would need me to get a webserver up & running somewhere. Not sure any of my customers would be happy with that idea.

I have created a playbook that can pull the required info I need to create a JSON file with just the options I need displayed in the multiple choice survey, but now I need something similar to the hack ‘url’ example to get the survey populated.
I know it will be an extra step for my end user, but I will work this into my hand over.

Any ideas from someone out there to fix this issue?
Ideally if i can replace the ‘url’ example below to point to a JSON file on the Tower Server, I could get my list populated.

Hopefully this makes sense.

Albert,

Since you have a playbook that fetches the JSON for the mulitple choice options you are just one step away from updating the survey with your multiple choice options. All you need to do is callback to tower in your playbook and update the survey spec. I explain how to callback to tower in another group reply here https://groups.google.com/forum/#!topic/awx-project/t3lhAFGy8po

For your case you want to update https://127.0.0.1:3251/api/v2/job_templates/5/survey_spec/ Below is an example of a multiple choice survey spec that I created w/ choices a,b,c

{
    "spec": [
        {
            "question_description": "",
            "min": null,
            "default": "a",
            "max": null,
            "required": true,
            "choices": "a\nb\nc",
            "variable": "test",
            "question_name": "Test multiple choice",
            "type": "multiplechoice"
        }
    ],
    "name": "",
    "description": ""
}

Hi Chris,

I have a similar situation and whilst I can write a playbook that updates the survey file, the issue I am trying to understand is how do I trigger this update process to run before the Survey is presented to the user?

i.e the user runs the job, the spec file is updated, then the survey is displayed to the user.

Every way I can see ( I hope I’m missing something ) the following happens:

the user runs the job
the survey is presented
the speckle is updated ( via a playbook - or inventory sync ).

I don’t see how a provisioning callback helps?

Many thanks in advance

The user experience isn’t going to be as smooth as you’d like but … You could ask that a user click to launch JTA that will update JTB. Then the user can launch JTB that will contain the updated survey.

-Chris

Would a workflow maybe work to do this for them?

No. Workflow prompting happens before the workflow kicks off; same as the job template. So same problem.

Thanks guys.