# Ensuring a setting in ansible.cfg

**URL:** <https://forum.ansible.com/t/ensuring-a-setting-in-ansible-cfg/18128>\
**Category:** Ansible Project\
**Created:** [April 29, 2015, 6:49pm UTC](https://forum.ansible.com/t/ensuring-a-setting-in-ansible-cfg/18128 "2015-04-29T18:49:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anand\_Buddhdev2](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@Anand\_Buddhdev2](https://forum.ansible.com/u/Anand_Buddhdev2)\
**Post date:** [April 29, 2015, 6:49pm UTC](https://forum.ansible.com/t/ensuring-a-setting-in-ansible-cfg/18128/1 "2015-04-29T18:49:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [April 29, 2015, 9:47pm UTC](https://forum.ansible.com/t/ensuring-a-setting-in-ansible-cfg/18128/2 "2015-04-29T21:47:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Anand\_Buddhdev2](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@Anand\_Buddhdev2](https://forum.ansible.com/u/Anand_Buddhdev2)\
**Post date:** [April 30, 2015, 12:26am UTC](https://forum.ansible.com/t/ensuring-a-setting-in-ansible-cfg/18128/3 "2015-04-30T00:26:17Z")

</div>

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
