Register var is var|succes when it was skipped (check_mode)

Hi

I recently created a bug report https://github.com/ansible/ansible/issues/8753 for this unexpected behaviour which was closed.

While it is not a big “deal” to fix it using always_run in the command task. I still think it is a bug.

In the docs http://docs.ansible.com/playbooks_variables.html#filters-often-used-with-conditionals this case is exactly described. It says there are 4 states of a variable

  • success → task state is changed and/or ok

  • failed → task state is failed

  • skipped → task state is skipped

  • changed → task state is changed

In my use case, the task is skipped but it is marked as successful. So the question is, is a task successful when it was skipped?

Thanks for your clarification.

Regards

René

Hmm, that does read differently now that you have highlighted it.

A skipped task does have a “skipped: True”, but it’s also successful (because it’s not a failure).

I could possibly be open to the persuassion that “|sucess” shouldn’t be true for skipped tasks, but that it should still return what it does when registering a skipped task.

Hi

Yeah if you want to send in a PR to core.py that would be welcome - if not, please file a feature request in github.

I suspect it will be super simple.

Hi