Simple assert failure

Simple, but I can’t figure it out. The following doesn’t appear to be working. Wondering if I have a syntax error?

`

  • assert:
    that:
  • user is defined
    msg: “Be sure to define the username under defaults/main.yml”

`

Whether it is defined or not in the defaults/main.yml it produces the following:

`

ok: [localhost] => {
“changed”: false,
“msg”: “All assertions passed”
}

`

It DOES work if I delete the variable completely instead of just leaving it empty

Thanks in advance

Listing a variable, even as an empty value, still defines it. It can only be undefined, if it hasn’t been listed at all.

You can add a check that is something like the following also:

  • user is not none

Perfect, thank you