ansible variable conditional tcheck

Hi,

I have a new problem,

When i want test exemple:

  • debug:
    msg: “ca fonctionne”
    when: ansible_user[5] == true

it don’t works. I want show this message “ca fonctionne” when ansible_user[5] exist

So when ansible_user == true

But this syntax don’t works.

Thank you

Try when: ansible_user[5] is defined

Thank you very much,

You are the best,

We can use :

ansible_user[5] is defined

and

ansible_user[5] is not defined

:wink: