Reputation: 7827
With ansible 1.9.2 I have a role with::
- include: snippet.yml repo=rep1
- include: snippet.yml repo=rep2
- include: snippet.yml repo=rep2
in snippet.yml
I have::
- name: debug
debug: msg='hello'
when: rep1 == {{ repo }}
But I get this error message::
fatal: [vagrant] => error while evaluating conditional: rep1 == rep1
FATAL: all hosts have already failed -- aborting
When I use the fist syntax proposed by @arbabnazar::
- name: debug
debug: msg='hello'
when: "rep1 == {{ repo }}"
I get this error::
TASK: [stack | debug] *******************************************
fatal: [vagrant] => error while evaluating conditional: rep1 == rep1
FATAL: all hosts have already failed -- aborting
With the second syntax proposed by @arbabnazar::
- name: debug
debug: msg='hello'
when: "rep1 in {{ repo }}"
I get this error::
TASK: [stack | debug] *******************************************
fatal: [vagrant] => error while evaluating conditional: rep1 in rep1
FATAL: all hosts have already failed -- aborting
Upvotes: 3
Views: 123
Reputation: 23791
Can you try this:
- name: debug
debug: msg='hello'
when: repo == "repo1"
Upvotes: 1