is there a way for a task to know if playbook is running in check-mode?

Hi people,

Some modules when running in check-mode still raising errors in certain conditions. For example, the service module fails when the service is not found, which is usually installed in a previous task on the playbook, which is kind of annoying. On the other hand, I understand that ansible should not ignore errors in check mode as rule, but I was wondering if I could set some specific tasks in the playbook to ignore errors when running in check-mode.

Is something like this possible?

Best regards,

Eric

There’s currently no magic variable set when a playbook is in check mode that “failed_when” could key off of.

I’m open to it.