Proposing the following feature idea in the hopes that someone will tell me it’s already available.
We currently run all of our playbooks through ansible-playbook -c as part of automated testing. We also have a callback that depends on some environment configuration in the __init__ function. It would be nice if we could determine if we are running under check_mode in the callback to skip this validation (you could also see this being useful for callbacks with other behaviour during init). This feature would be similar to how you can determine, in an Ansible module, if you are in check_mode to change the behaviour.
Ah! Thank you Matt, I didn’t realize it’d be available via the playbook; I can move initialization there.
Michael, the custom callback is doing Hipchat notification (similar to https://github.com/ansible/ansible/blob/devel/plugins/callbacks/hipchat.py) and requires some environment variables to be set to run. If they aren’t set it outputs a warning (similar to the example plugin). We were just trying to avoid the warnings during ansible-playbook -c.