Survey variables
Survey variables are custom input fields you can add to task templates to collect user input when running tasks. Instead of hard-coding values in your playbooks or scripts, you can define custom variables that prompt users for values at runtime.
This feature is useful for:
- Running the same template with different parameters (e.g., configuration values)
- Accepting dynamic input via API calls
- Passing custom parameters in scheduled tasks
- Triggering tasks from integrations with extracted webhook data

Survey variables vs. Prompts
It's important to understand the difference between survey variables and prompts:
| Feature | Survey Variables | Prompts |
|---|---|---|
| Definition | Custom fields you create | Predefined template-specific options |
| Examples | Environment name, version number, API endpoint | Ansible: --limit, --tagsTerraform: workspaces |
| Configuration | Add in template settings with name and type | Enable via checkboxes in template |
| Passed as | Ansible: --extra-varsTerraform: -var | Built-in CLI flags |
Survey variables are flexible custom fields you define yourself, while prompts are built-in options specific to each template type (like Ansible's --limit or --tags flags).
Adding survey variables to a template
Survey variables are configured in the template settings:
- Go to Task Templates and select your template
- Navigate to the Survey Variables section in template settings
- Click Add Survey Variable
- Configure the variable:
- Name: Variable name (used in your code)
- Title: Display label shown in the form
- Type: Choose the field type
- Pass variable as: Extra variable (default) or environment variable
- Default value: Optional pre-filled value shown when the task form opens
- Required: Whether the field must be filled
- Save the template
When users run a task from this template, they'll see a form with your custom survey variables.
Variable types
Survey variables support six types:
String
Text input field for string values.
Use cases: Environment names, branch names, hostnames, file paths
Example: A variable named environment prompts users to enter "production", "staging", or "development"
Integer
Numeric input field for integer values.
Use cases: Port numbers, retry counts, timeouts, resource limits
Example: A variable named timeout_seconds prompts users to enter "300" or "600"
Text
Multiline textarea for longer string values.
Use cases: Commit messages, JSON snippets, free-form notes, multi-line configuration
Example: A variable named changelog where users paste release notes before deployment
Enum (single-select)
Dropdown menu where the user picks exactly one option from a predefined list.
Use cases: Environment type, deployment strategy, boolean-like choices
Example: A variable named deployment_type with options: "rolling", "blue-green", "canary"
When creating an enum variable, add each option with a display label and value in the variable editor.
Select (multi-select)
Dropdown where the user can pick one or more options from a predefined list. Selected values are passed as a JSON array (for example ["staging","production"]), not as a single string.
Use cases: Target regions, feature flags, multiple host groups, tag lists
Example: A variable named target_regions with options us-east-1, eu-west-1, ap-southeast-1
Constraints:
- Default values must be chosen from the option list and can include multiple selections
- In Bash, PowerShell, and Python templates, parse the JSON array from the argument or environment value (see examples below)
Secret
Password input field where the value is hidden.
Use cases: API keys, passwords, tokens, sensitive configuration
Example: A variable named api_token where the entered value appears as dots for security
Default values
You can set an optional default for most variable types. When a user opens the task run dialog, fields are pre-filled with these defaults.
- String, integer, text, secret: a single default value
- Enum: one option from the list
- Select: one or more options from the list
Defaults are useful for schedules and integrations where the same template runs repeatedly with predictable parameters. Users can still change the values before starting a task.
Pass variable as (target)
Each survey variable can be delivered in one of two ways:
| Setting | Behavior |
|---|---|
| Extra variable (default) | Passed the app-specific way: Ansible --extra-vars, Terraform -var, or name=value CLI arguments for shell apps |
| Environment variable | Set as a process environment variable whose name matches the survey variable name |
Use Environment variable when your script or tool reads from the environment instead of CLI flags. For Terraform variables that must follow the TF_VAR_ convention, name the survey variable TF_VAR_instance_type and set the target to environment variable.
Variables with the environment target are not duplicated in extra-vars, -var, or CLI arguments. Each value is delivered exactly once.
How survey variables are passed to tasks
Survey variables are passed differently depending on the template type and the Pass variable as setting.
Multi-select (select type) values are JSON-encoded arrays in every delivery path (extra-vars JSON, -var, CLI arguments, and environment variables). A selection of options 1 and 2 becomes ["1","2"], not a space-separated string.
Ansible templates
Survey variables are passed as Ansible extra variables using the --extra-vars flag.
Example: If you define a survey variable named app_version:
---
- hosts: webservers
tasks:
- name: Deploy application
command: deploy.sh {{ app_version }}
When running the task, the user enters "2.5.0" in the survey form, and Ansible receives it as:
ansible-playbook playbook.yml --extra-vars "app_version=2.5.0"
Terraform/OpenTofu templates
Survey variables are passed as Terraform variables using the -var flag.
Example: If you define a survey variable named instance_count:
variable "instance_count" {
type = number
description = "Number of instances to create"
}
resource "aws_instance" "web" {
count = var.instance_count
instance_type = "t2.micro"
# ... other configuration
}
When running the task, the user enters "3" in the survey form, and Terraform receives it as:
terraform apply -var="instance_count=3"
Shell/Bash templates
Survey variables are passed to the Bash script as command-line arguments:
/bin/bash your_script.sh var1=val1 var2=val2 ... varN=valN
You can use following code inside the script to parse the arguments to array:
declare -A args
for arg in "$@"; do
KEY="${arg%%=*}"
VALUE="${arg#*=}"
args["$KEY"]="$VALUE"
done
echo "ARG1: ${args[ARG1]}"
echo "ARG2: ${args[ARG2]}"
For multi-select variables, the value is a JSON array string. Parse it with jq (ensure jq is available in your executor image):
regions_json='["us-east-1","eu-west-1"]'
regions=$(echo "$regions_json" | jq -r '.[]')
for region in $regions; do
echo "Deploying to $region"
done
PowerShell templates
Survey variables are passed to the running PowerShell script as command-line arguments:
pwsh your_script.sh var1=val1 var2=val2 ... varN=valN
To parse the arguments, use the following code in the running script:
$parsed = @{}
foreach ($a in $args) {
if ($a -match "^([^=]+)=(.*)$") {
$key = $matches[1]
$val = $matches[2]
$parsed[$key] = $val
}
}
Write-Host "Parsed arguments:"
write-host $parsed['env1']
write-host $parsed.env1
For multi-select variables, parse the JSON array from the argument value:
$regions = $parsed['target_regions'] | ConvertFrom-Json
foreach ($region in $regions) {
Write-Host "Deploying to $region"
}
Python templates
Survey variables are passed to the running Python script as command-line arguments:
python3 your_script.sh var1=val1 var2=val2 ... varN=valN
To parse the argument use following code in the running script:
import sys
parsed = {}
for arg in sys.argv[1:]:
if "=" in arg:
key, val = arg.split("=", 1)
parsed[key] = val
print("Parsed arguments:")
print(parsed.get("env1"))
print(parsed["env1"] if "env1" in parsed else None)
For multi-select variables, parse the JSON array:
import json
regions = json.loads(parsed["target_regions"])
for region in regions:
print(f"Deploying to {region}")