How to check the variable does exist and is different from space
I tried without success a fail … when :
when: item.0 is not defined
when: item.name is not defined
when: item.name ==‘’
I tried to use a register variable but I cannot find the way to test the register variable content.
I understand the |default() can be used to run a loop only if the item is not an empty list,
But I can’t find a way to proceed to quit the playbook if one parameter is missing:
vars: booleen: False
set_facts:
booleen: True
with_items:
“{{ KARAFHTTPTIMEOUT|default() }}”
“{{ dbType|default() }}”
if all parameters are empty, booleen is False and I can use fail: … when booleen = False
But if only one parameter is missing, booleen is true.
Thanks for helping: my purpose is to verify that all parameters are set in a csv file and to fail of one is missing.
Finally this is still not OK as this bypass solution only works for ampty parameters.
if parameters are set but not intialized, or set to space, this is not ok