Inside a an Ansible Jinja2 template I'm trying to set a "default" value which also has a variable in it but it's printing out the literal rather than interpolating it.
For example:
homedir = {{ hostvars[inventory_hostname]['instances'][app_instance]['homedir'] | default("/home/{{ app_instance }}/airflow") }}
returns:
airflow_home = /home/{{ app_instance }}/airflow
How to refer to the app_instance
variable?
Inside Jinja2 expression use Jinja2 syntax. You should concatenate strings to a variable value: