I have some ansible tasks that are run in two parts. The first part sets a condition, and the second part uses when
to conditionally execute. Pseudo-example:
- name: check if installed
command: (...)
register: is_installed
- name: run install script
when: is_installed.stdout == "yes"
command: (...)
The second task shows as "skipped". This is not really right, I did not forgo the installation, but confirmed that it was already done, so it should show as "OK". It should show "skipped" only if the given host doesn't need this step. I know this is just cosmetic, but I would still like to know if there is a way to get it to say "OK".
I tried setting changed_when
to False
. While this sets the result to OK, it still runs the command. Somebody asked for an ok_when
setting, but it was declined and I'm not sure the developers understood the request.