# Loading role vars without executing role

**URL:** <https://forum.ansible.com/t/loading-role-vars-without-executing-role/36417>\
**Category:** Ansible Project\
**Created:** [March 9, 2022, 8:32pm UTC](https://forum.ansible.com/t/loading-role-vars-without-executing-role/36417 "2022-03-09T20:32:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Manno](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/paul_manno/32/2804_2.png) [@Paul\_Manno](https://forum.ansible.com/u/Paul_Manno)\
**Post date:** [March 9, 2022, 8:32pm UTC](https://forum.ansible.com/t/loading-role-vars-without-executing-role/36417/1 "2022-03-09T20:32:06Z")

</div>

Hello,

A bit of background… I manage multiple applications. Each application has an ansible role defined for it. Sometimes, there is a playbook that is common to each application, but I would prefer to keep this playbook out of the ansible role and instead use the playbook from the parent project (to reduce code duplication); however, I do still need all the vars that are specific to the role in the playbook. Is there a way to load a role, but not have it execute at all? Just so I can reference the role variables? I tried including\_vars from roles/\<role\_name/defaults/main.yml but that does not seem to work. I did get it working by importing the role (my main.yml is a noop unless some flags are set) and that does work, but I’d prefer it if the role did not execute at all.

Thanks,  
Paul

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [March 21, 2022, 3:36pm UTC](https://forum.ansible.com/t/loading-role-vars-without-executing-role/36417/2 "2022-03-21T15:36:33Z")

</div>

There is no direct feature to include vars from a role without executing it. However, it can be achieved if the role is created in a way that provides a noop tasks file. If you use `import_role`, you can specify `tasks_from` to tell it to use tasks from that noop file.
