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

**URL:** <https://forum.ansible.com/t/is-there-a-way-for-a-task-to-know-if-playbook-is-running-in-check-mode/14030>\
**Category:** Ansible Project\
**Created:** [November 29, 2013, 3:10am UTC](https://forum.ansible.com/t/is-there-a-way-for-a-task-to-know-if-playbook-is-running-in-check-mode/14030 "2013-11-29T03:10:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric2](https://avatars.discourse-cdn.com/v4/letter/e/8c91f0/32.png) [@eric2](https://forum.ansible.com/u/eric2)\
**Post date:** [November 29, 2013, 3:10am UTC](https://forum.ansible.com/t/is-there-a-way-for-a-task-to-know-if-playbook-is-running-in-check-mode/14030/1 "2013-11-29T03:10:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [November 29, 2013, 4:15pm UTC](https://forum.ansible.com/t/is-there-a-way-for-a-task-to-know-if-playbook-is-running-in-check-mode/14030/2 "2013-11-29T16:15:51Z")

</div>

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.
