/usr/share/doc/ansible-tower-cli/SURVEYS.md is in ansible-tower-cli-doc 3.2.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | # How to manage surveys of job templates and workflows through tower-cli
This feature is added in v3.1.0, and v3.1.3 or higher, at least, is recommended.
get help: `tower-cli job_template survey --help`
## View a Survey
The name of the job template is known ("survey jt" in this example), and the
survey definition is desired.
`tower-cli job_template survey --name="survey jt"`
Example output, this is the survey spec:
```json
{
  "description": "", 
  "spec": [
    {
      "required": true, 
      "min": null, 
      "default": "v3.1.3", 
      "max": null, 
      "question_description": "enter a version of tower-cli to install", 
      "choices": "v3.0.0\nv3.0.1\nv3.0.2\nv3.1.0\nv3.1.1\nv3.1.2\nv3.1.3", 
      "new_question": true, 
      "variable": "version", 
      "question_name": "Tower-cli version", 
      "type": "multiplechoice"
    }, 
    {
      "required": true, 
      "min": null, 
      "default": "click\ncolorama\nrequests\nsix\nPyYAML", 
      "max": null, 
      "question_description": "which package requirements would you like to install/check", 
      "choices": "click\ncolorama\nrequests\nsix\nPyYAML", 
      "new_question": true, 
      "variable": "packages", 
      "question_name": "Package requirements", 
      "type": "multiselect"
    }
  ], 
  "name": ""
}
```
## Save a survey
Use the job template `modify` command to do this. In order to create a
_functional_ survey you must do two things:
 - Save the survey spec - use the `--survey-spec` option
 - Enable the survey - use the `--survey-enabled` option
Example of enabling the survey on a job template:
 ```
 tower-cli job_template modify --name="hello world infinity" --survey-enabled=true
 ```
The `--survey-spec` option can get the spec from a file by prepending the `@`
character. If this character is not used, it is assumed that you are giving
the JSON data in-line.
### Copy a survey to another template
The following example saves a survey spec to a file, and then uploads that
survey spec to another job template.
```bash
# Save the survey spec to file in local directory
tower-cli job_template survey --name="survey jt" > s.json
# Upload that survey to another job template
tower-cli job_template modify --name="another jt" --survey-spec=@s.json --survey-enabled=true
```
The next example using one line to do the same thing on the command line.
```
tower-cli job_template modify --name="another jt" --survey-spec="$(tower-cli job_template survey --name='survey jt')" --survey-enabled=true
```
## Workflows
Workflows can also have surveys and follow the same pattern. Example:
`tower-cli workflow survey --name="workflow with survey"`
 |