Hi
So new to ansible. I am using win_reg_stat to lookup registry keys to ultimately uninstall some software. If the reg entry is found, myvar.value ( after defining "register: myvar") contains the registry value. If it is not found, that key is not defined in the myvar dict.
Problem I have is that I cannot use below in both cases as if they key does not exist, it fails with Ansible defined variable error
Set_fact:
Thisvar: {{ myvar.value }}
When: myvar.value is defined
I have tried a when: clause with is/is not defined, but the presence of the .value key in the setting of the variable/fact name causes failure. I would of thought (or liked to think), the when condition would prevent the setting and thus check of the undefined variable.
Any thoughts?
Thanks