You should generally provide your full task, so I'm going to take a guess
here.

I am pretty sure the problem is that you are using `with_items: users`
also.  The problem is that `when` statements are evaluated *after*
`with_items`, since the `when` statement is evaluated per item in the loop.

On Tue, Sep 20, 2016 at 5:42 AM, pixel fairy <pixelfa...@gmail.com> wrote:

> using ansible 2.1.1.0
>
> running a task with 'when: users is defined' works fine for hosts that
> have that variable. for hosts that dont, the play still runs, but gives a
> warning that in the future, an undefined variable will be a fatal error. is
> there another way of running tasks based on the existence of a given var?
>
> --
> 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 ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/c5e217aa-c58b-41c6-ad76-4911e6fdd8f6%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/c5e217aa-c58b-41c6-ad76-4911e6fdd8f6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v9wKfg9D-wbdeWDc4KnQXi58bTZ3zLb%2B2O_nzg%3Dhm2dsg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to