After unsetting environment variable with no_log flag from host I'm registering the output into another variable. The variable looks like this:
"before_value": "xxxx",
"changed": true,
"invocation": {
"module_args": {
"level": "machine",
"name": "xxxx",
"state": "absent",
"value": null
}
},
"value": null
In next task I want to fail the job if the value of the"value" part is not null. I've tried:
- name: Fail setup if xxx varaible wasn't correctly unset
fail:
msg: "xxx varaible wasn't correctly unset"
when: variable.value != null
But it doesn't work and returns this output:
"msg": "The conditional check 'variable.value != null' failed. The error was: error while evaluating conditional (variable.value != null): 'null' is undefined\n\nThe error appears to be in '/tmp/awx_495499_tuyjhnpl/project/tasks/unset-environment-variables.yml': line 14, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Fail setup if variable wasn't correctly unset\n ^ here\n",
"_ansible_no_log": false