First, that's a really old version of ansible, and you need to upgrade.

Second, the "when" clause uses jinja syntax and it's complaining that
it can't evaluate your syntax: it's a syntax error, not a fact error.
In jinja, the "not" needs to come before the expression it's negating.
Try something like this:

when: not ansible_eth1.ipv4.address is defined

On Tue, Nov 25, 2014 at 5:38 AM, Linto Paulson <[email protected]> wrote:
> I wanted to accomplish something like this. I wanted to use the ansible
> facts like ansible_eth0.ipv4.address to check if this fact is defined.
>   - name: Check if eth0 interface setup
>     fail: msg="eth0 interface not setup"
>     when: ansible_eth0.ipv4.address  is not defined
>
> But ansible is throwing error at me
>
> I am using gather_facts: yes
>
> fatal: [xxxxxxxxx] => error while evaluating conditional:
> ansible_eth1.ipv4.address is not defined
>
> I am using 1.5.4
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/2eed6eeb-07bc-46b1-89e6-f4294c04d209%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAJQqANfe4NbhwMXGBCwfm%2BZP-Sx%2BSgH37hbo0peTym74HkrUPA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to