Hello togather,
My goal is to create/import organizations, users, inventories, projects and job templates with surveys via the CLI.Everything is working fine except creating a survey.
The exmple survey question I want to import is:
{
‘description’: ‘A survey’
‘spec’:[{
‘index’: 0,
‘question_name’: ‘What is your department’,
‘required’: False,
‘variable’: ‘department’,
‘type’: ‘password’,
‘max’: 3
}],
‘name’: ‘my survey’
}
The varibale “department” is part of my playbook and if I add the question manually via the UI everything works fine.
As I understand I can add the survey question either by directly writing it at the creation of the job_template (of course after the corresponding project is created):
awx job_template create --name “XXX” --job_type run --inventory “YYY” --project “ZZZ” --playbook “AAA.yaml” --survey_spec ‘{“spec”:[{ ‘index’: 0, question_name’: ‘What is your department’, ‘required’: False, variable’: ‘department’, type’: ‘password’, max’: 3 }], “description”: “a survey”, “name”: “my survey”}’ --survey_enable=true
or by saving the upper survey as survey.json and import it like : awx job_template create --name “XXX” --job_type run --inventory “YYY” --project “ZZZ” --playbook “AAA.yaml” --survey_spec @/var/lib/awx/projects/BBB/survey.json --survey_enable=true
(here /var/lib… is the path to the survey.json)
But both ways didn´t work. Also I tried changing up " and ’ and I omitted the @ and saved the survey as a non-json.
When I execute I get the following feedback I attached as screenshots. For me it looks like the survey_enable variable is set but somehow it does not store or canot access the data stored in survey_spec.
Does anybody have the same problem or does anybody see a mistake in what I do?
Cheers
Annemike