# Check mode by default

**URL:** <https://forum.ansible.com/t/check-mode-by-default/16369>\
**Category:** Ansible Developer\
**Created:** [September 29, 2014, 2:51pm UTC](https://forum.ansible.com/t/check-mode-by-default/16369 "2014-09-29T14:51:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Morgan](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@Peter\_Morgan](https://forum.ansible.com/u/Peter_Morgan)\
**Post date:** [September 29, 2014, 2:51pm UTC](https://forum.ansible.com/t/check-mode-by-default/16369/1 "2014-09-29T14:51:26Z")

</div>

I think it might be useful to have an ansible.cfg setting to enable check mode to be the default behavior of ansible/ansible-playbook. It is far too easy to accidentally forget the -C and fire off a script that does something unintended, especially for those new to ansible. If this were to be implemented, it would necessitate another flag such as “–force” to bypass check mode and run the deployment.

Is is sensible enough to offer this out of the box?

Thanks,  
pete

---

<div class="post-metadata">

**Author:** ![Jonathan\_Mainguy](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@Jonathan\_Mainguy](https://forum.ansible.com/u/Jonathan_Mainguy)\
**Post date:** [September 29, 2014, 2:56pm UTC](https://forum.ansible.com/t/check-mode-by-default/16369/2 "2014-09-29T14:56:00Z")

</div>

I personally would have it stay the way as is, and not default to check mode.

---

<div class="post-metadata">

**Author:** ![Johannes\_Truschnigg](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@Johannes\_Truschnigg](https://forum.ansible.com/u/Johannes_Truschnigg)\
**Post date:** [September 29, 2014, 3:54pm UTC](https://forum.ansible.com/t/check-mode-by-default/16369/3 "2014-09-29T15:54:26Z")

</div>

I think it makes little sense to implement this in ansible - but your  
shell is a fine place to get this behaviour:

$ alias ansible="ansible --check"

If you want to call the \_real\_ ansible, without the automatic --check  
appended as the first argument, just make your shell execute "\ansible"  
(with a backslash in front) instead. Problem solved.

---

<div class="post-metadata">

**Author:** ![Peter\_Morgan](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@Peter\_Morgan](https://forum.ansible.com/u/Peter_Morgan)\
**Post date:** [September 29, 2014, 4:49pm UTC](https://forum.ansible.com/t/check-mode-by-default/16369/4 "2014-09-29T16:49:07Z")

</div>

Jonathan: To be clear: I am not asking to change the default behavior of ansible to check mode for everyone. I am asking to have the _ability_ to turn this on in some environments via a config setting. What works for you may not work best for everyone in every environment.

Call me crazy, but I think it is kludgy to have to create wrappers and aliases around the commands because they cannot be made to have defaults which might be sensible in some environments. I am a bit surprised I am the only one to see value in this proposal - everyone to whom I’ve shown ansible has had the reaction within the first several minutes of “Oh - this can be really dangerous if you’re not very careful.” I would think some would like the choice of a more defensive posture by default.

Maybe it is just my impression. Shrug.

pete

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 29, 2014, 9:18pm UTC](https://forum.ansible.com/t/check-mode-by-default/16369/5 "2014-09-29T21:18:00Z")

</div>

We would be denying a flag on this, check mode can’t simulate everything effectively and already has sufficient caveats that probably don’t warrant the even small overhead of documentation, config setting, and logic.

Mostly it’s a cognitive load thing - we want to minimize the number of things people have to think about.

---

<div class="post-metadata">

**Author:** ![Peter\_Morgan](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@Peter\_Morgan](https://forum.ansible.com/u/Peter_Morgan)\
**Post date:** [September 29, 2014, 10:14pm UTC](https://forum.ansible.com/t/check-mode-by-default/16369/6 "2014-09-29T22:14:20Z")

</div>

Okay, thanks for consideration, all.

pete
