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
I personally would have it stay the way as is, and not default to check mode.
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.
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
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.
Okay, thanks for consideration, all.
pete