# Nesting roles and omitting vars

**URL:** <https://forum.ansible.com/t/nesting-roles-and-omitting-vars/19249>\
**Category:** Ansible Project\
**Created:** [September 13, 2015, 6:33am UTC](https://forum.ansible.com/t/nesting-roles-and-omitting-vars/19249 "2015-09-13T06:33:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arnaud\_Mazin](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@Arnaud\_Mazin](https://forum.ansible.com/u/Arnaud_Mazin)\
**Post date:** [September 13, 2015, 6:33am UTC](https://forum.ansible.com/t/nesting-roles-and-omitting-vars/19249/1 "2015-09-13T06:33:18Z")

</div>

Hi

I’m trying to nest roles using dependencies in order to reuse as much code as possible and get into trouble when trying to omit some parameters

My setup:

`

# roles/roleA/tasks/main.yml

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [September 14, 2015, 10:27am UTC](https://forum.ansible.com/t/nesting-roles-and-omitting-vars/19249/2 "2015-09-14T10:27:54Z")

</div>

In your RoleB role, use a defaults file to handle default variables. That will ensure you always have the var\_roleb variable defined.  
[http://docs.ansible.com/ansible/playbooks\_roles.html#role-default-variables](http://docs.ansible.com/ansible/playbooks_roles.html#role-default-variables)

---

<div class="post-metadata">

**Author:** ![Arnaud\_Mazin](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@Arnaud\_Mazin](https://forum.ansible.com/u/Arnaud_Mazin)\
**Post date:** [September 14, 2015, 11:36am UTC](https://forum.ansible.com/t/nesting-roles-and-omitting-vars/19249/3 "2015-09-14T11:36:49Z")

</div>

Hello.

It doesn’t exactly meet my need, I’d like to be able to write:

`

# roles/roleA/tasks/main.yml
