# pass variables to the role with file from playbook or from dependencies

**URL:** <https://forum.ansible.com/t/pass-variables-to-the-role-with-file-from-playbook-or-from-dependencies/18169>\
**Category:** Ansible Project\
**Created:** [May 6, 2015, 2:15pm UTC](https://forum.ansible.com/t/pass-variables-to-the-role-with-file-from-playbook-or-from-dependencies/18169 "2015-05-06T14:15:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oleksii\_Asiutin](https://avatars.discourse-cdn.com/v4/letter/o/9de0a6/32.png) [@Oleksii\_Asiutin](https://forum.ansible.com/u/Oleksii_Asiutin)\
**Post date:** [May 6, 2015, 2:15pm UTC](https://forum.ansible.com/t/pass-variables-to-the-role-with-file-from-playbook-or-from-dependencies/18169/1 "2015-05-06T14:15:30Z")

</div>

Hallo everyone.

I have the next problem.

I have two roles: database and service1 for example.

database role has defaults/main.yml with default variables.  
I want service1 role has a dependency on the database role and I want to pass specific vars to database role to override it’s default variables.

so service1 meta/main.yml file will look something like:

dependencies:

- { role: database, file\_with\_vars\_to\_include: database.yml }

or in playbook file

roles:

- { role: database, file\_with\_vars\_to\_include: roles/service1/vars/database.yml }

I’ve tried ‘include’ and ‘vars\_files’ but It seems not to work.

Kind regards,  
Oleksii.
