Ensuring a setting in ansible.cfg

Skip to first unread message

Anand Buddhdev

unread,
Apr 29, 2015, 2:49:56 PM4/29/15
to ansible...@googlegroups.com
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

Brian Coca

unread,
Apr 29, 2015, 5:47:42 PM4/29/15
to ansible...@googlegroups.com
You can use lookup('env' ..) to check for the variable, but currently
there is no way to dynamically check for a setting.



--
Brian Coca

Anand Buddhdev

unread,
Apr 29, 2015, 8:26:17 PM4/29/15
to ansible...@googlegroups.com
On Wednesday, 29 April 2015 23:47:42 UTC+2, Brian Coca wrote:

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 
Reply all
Reply to author
Forward
0 new messages