Hi guys,
I've got a setup which sets a fact based on whether a file exists or not.
This fact works for one run in the play but doesn't work when I want that value to be removed for another task inside the play.
register: bucket_policy_status
when: bucket_policy_status.stat.exists
- name: Set policy variable to None when bucket policy doesn't exist for {{ bucket_name.name }} bucket_policy_json: "{{ omit }}"
when: not bucket_policy_status.stat.exists
policy: "{{ bucket_policy_json | default(omit) }}"
profile: "{{ aws_account_name }}"
region: "{{ bucket_name.region }}"
Is there a way to "unset" a set_fact to something that default(omit) can recognise?
At the moment, if the first run through sets bucket_policy_json to a value, the next thing that comes along that hits the when: not bucket_policy_status.stat.exists statement does not successfully clear that fact to an undefined state.
Is there a magic variable to "undefine" a fact by any chance?
Regards
Karen