Why am I not able to use changed_when
to change the state of a task that return failed
to changed
?
For example, I have a custom module that allows me to check the existence of a volume, it will failed if the volume doesn't exist.
Playbook snippet:
---
- name: Example ansible playbook
tasks:
- name: Check existence of the volume
custom_name_space_my_volume:
name: ABC #name of the volume
changed_when: true
If the volume ABC
doesn't exist, the result is failed
. But why didn't change_when: true
causes the result to return changed
instead?
Note: The example above might not make logical sense since it's not doing something useful. But I just wanted to use it as a sample for the question I have.