# Using Ansible.cfg with roles and tasks

**URL:** <https://forum.ansible.com/t/using-ansible-cfg-with-roles-and-tasks/21323>\
**Category:** Ansible Project\
**Created:** [May 1, 2016, 6:53pm UTC](https://forum.ansible.com/t/using-ansible-cfg-with-roles-and-tasks/21323 "2016-05-01T18:53:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rick\_O\_Shea](https://avatars.discourse-cdn.com/v4/letter/r/65b543/32.png) [@Rick\_O\_Shea](https://forum.ansible.com/u/Rick_O_Shea)\
**Post date:** [May 1, 2016, 6:53pm UTC](https://forum.ansible.com/t/using-ansible-cfg-with-roles-and-tasks/21323/1 "2016-05-01T18:53:03Z")

</div>

I have roles that depend on the **ssh\_args** settings of the local Ansible.cfg, and they succeed.

I also have a role that assumes different **ssh\_args** values, and it fails.

How do we specify Ansible.cfg settings specific to a role or to a playbook (that uses those roles)?

/playbooks  
a.yml  
b.yml  
c\*\*.\*\*yml  
Ansible.cfg  
/roles  
/foo  
/bar  
/baz  
/qux

I haven’t seen any information using Ansible.cfg with roles.

Ugly workaround: completely separate folder hierarchy for each Ansible.cfg group.

---

<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:** [May 2, 2016, 10:17pm UTC](https://forum.ansible.com/t/using-ansible-cfg-with-roles-and-tasks/21323/2 "2016-05-02T22:17:40Z")

</div>

you can set the equivalent host var (ansible\_ssh\_args), in group\_vars/all adjacent to play.
