Hi,
After a task
- name: check file existence
stat: path=/var/run/file
register: file
I can do this in any of my tasks
…something… my_param={% if file.stat.exists %} file {% else %} url {% endif %}
to get my_param right according to whether ‘file’ exists or not. However I would like to just write in my tasks ‘my_param={{my_var}}’.
For that I would like to define a variable my_var in vars/main.yml, but I can’t use the same jinja2-fu there. It complains as soon as it finds a ‘%’ (different execution context?)
How does one evaluate vars with this kind of logic constructs?
Thanks in advance.
Best regards,
Vasco