Ansible Jinja expressions
- Use a default variable:
# Sets the region variable to the value of "my_region" or defaults to 'us-east-1'.
region: "{{ my_region | default('us-east-1') }}"
# Sets the region variable to the value of "my_region" or defaults to whatever "your_region" is.
region: "{{ my_region | default(your_region) }}"
- Convert an Ansible variable to an integer and increment it.
# convert to an integer and increase by 1.
# this is a string, not an integer
string: "3"
# this will equal 4.
variable: "{{ string | int + 1 }}"