Ensuring a setting in ansible.cfg

I’ve structured one of my roles to rely upon the “merge” setting of “hash_behaviour”. If I want let my colleagues use this role, then they too must set this in their ansible.cfg file, or the environment variable ANSIBLE_HASH_BEHAVIOUR.

Is there any way to have a check in a playbook that will make the play fail if this setting isn’t set correctly?

Anand

You can use lookup('env' ..) to check for the variable, but currently
there is no way to dynamically check for a setting.

Thanks Brian! I’ve combined the lookup with “assert” and it works perfectly. The play fails if the environment variable isn’t set, or is set to the wrong value.

Regards,
Anand