# Creating Surveys via CLI does not work

**URL:** <https://forum.ansible.com/t/creating-surveys-via-cli-does-not-work/34114>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [October 27, 2020, 10:18am UTC](https://forum.ansible.com/t/creating-surveys-via-cli-does-not-work/34114 "2020-10-27T10:18:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Annemike100](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Annemike100](https://forum.ansible.com/u/Annemike100)\
**Post date:** [October 27, 2020, 10:18am UTC](https://forum.ansible.com/t/creating-surveys-via-cli-does-not-work/34114/1 "2020-10-27T10:18:31Z")

</div>

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

> **(attachments)**
>
> ![2.PNG](https://us1.discourse-cdn.com/ansible/original/2X/f/f481e1f01a0c5d1ebd572c7cbd77889a3c43bbc9.png)  
> ![Unbenannt.PNG](https://us1.discourse-cdn.com/ansible/original/2X/f/fa895ae194f34bcb820e159fad101068964457da.png)  
> ![1.PNG](https://us1.discourse-cdn.com/ansible/original/2X/9/97f40ee87c2d89dcd61cba0efab5b38ff63012fb.png)

---

<div class="post-metadata">

**Author:** ![Annemike100](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Annemike100](https://forum.ansible.com/u/Annemike100)\
**Post date:** [November 6, 2020, 11:31am UTC](https://forum.ansible.com/t/creating-surveys-via-cli-does-not-work/34114/2 "2020-11-06T11:31:30Z")

</div>

The solution for this issue can be found here [https://github.com/ansible/awx/issues/8464](https://github.com/ansible/awx/issues/8464)
