Reputation: 33
I have an ansible playbook where I define a local variable and I want to execute a statement when this local variable is equal with the system variable. For example:
vars:
dev_env: DEV
....
TASK
- name:
win_copy:
...
when: {{ system_variable}} == dev_env
However I always get an error even if I enclose the dev_env into {{}}, if I use "", etc. I have tried all potential combinations. Do you have a working example so that I could use it as a template?
Upvotes: 1
Views: 356
Reputation: 12008
I want to execute a statement when this local variable is equal with the system variable.
According Ansible documentation Conditionals
when: system_variable == dev_env
Further Documentation
Upvotes: 1