Ansible Tower 3.8.6 - Workflow Survey - Updating choices on one survey question

Posted on

Hello all! I have been racking my brain on how to update one field in the survey spec to one survey question. I'm unable to write the code to actually get this done while still maintaining the survey flow as is so when it's executed the questions will stay in the same place every time. Or I make some overly complex code that I begin to making this much harder that I think it should be. There are some specific requirements I'm trying to stick to:

1) The survey MUST keep the same flow of questions. They cannot be reordered.
2) Must be written in ansible yaml. No python and no external code

Here is the spec:

"spec": [
{
"variable": "computer_ou",
"required": true,
"question_description": "Select Computer OU",
"default": "Select Computer OU",
"question_name": "Computer OU",
"type": "multiplechoice",
"choices": "Updated Stuff!\nSelect Computer OU" <<<<<< Option that needs updating
},
{
"question_description": "dsdsdsdsds",
"min": 0,
"default": "dsdsdsdsds",
"max": 1024,
"required": true,
"choices": "",
"new_question": true,
"variable": "dsdsdsdsds",
"question_name": "Sddsdsdsds",
"type": "text"
},
{
"question_description": "222222",
"min": 0,
"default": "dsdsdsdsdsds",
"max": 1024,
"required": true,
"choices": "",
"new_question": true,
"variable": "dasasas",
"question_name": "Ddeddeee",
"type": "text"
},
{
"question_description": "qqqwress",
"min": 0,
"default": "45454redredewdeswdew",
"max": 1024,
"required": true,
"choices": "",
"new_question": true,
"variable": "aaaaaa",
"question_name": "234ewewewewew",
"type": "text"
}
]

The very 1st question "Select Computer OU" choices is what needs updating and no other data point in the spec. I have written code to split out the 4 survey questions and have been successful in making the change in memory but putting it all back together and in the correct order was overly complex and want to go a different direction.

And I have tried some of the modules for tower but that of course needs python the system process the request. And that system does not have python on it. So I'm basically trying to stick to the uri module and try and use everything that would be considered native that does not require external modules.

If anyone has done this or can at least help progress me thru getting the data changed in the dictionary it would be helpful. I just wish the survey spec was keyed...That would make it easier to reference and change.

Thanks.

Glen

Responses