# use vars from include\_role

**URL:** <https://forum.ansible.com/t/use-vars-from-include-role/24578>\
**Category:** Ansible Project\
**Created:** [May 25, 2017, 10:14pm UTC](https://forum.ansible.com/t/use-vars-from-include-role/24578 "2017-05-25T22:14:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Stroder](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@Michael\_Stroder](https://forum.ansible.com/u/Michael_Stroder)\
**Post date:** [May 25, 2017, 10:14pm UTC](https://forum.ansible.com/t/use-vars-from-include-role/24578/1 "2017-05-25T22:14:20Z")

</div>

HI!

I want to use the following task (with ansible ansible-2.3.1.0-0.2.rc2):

- name: "Install web2ldap on {{ openldap\_role }}"  
&nbsp;&nbsp;include\_role:  
&nbsp;&nbsp;&nbsp;&nbsp;name: web2ldap  
&nbsp;&nbsp;&nbsp;&nbsp;private: False  
&nbsp;&nbsp;vars:  
&nbsp;&nbsp;&nbsp;&nbsp;web\_server: "apache2"  
&nbsp;&nbsp;&nbsp;&nbsp;web2ldap\_pip\_index\_url: "{{ aedir\_pip\_index\_url }}"  
&nbsp;&nbsp;&nbsp;&nbsp;web2ldap\_pip\_needs\_compiler: "{{ aedir\_pip\_needs\_compiler }}"  
&nbsp;&nbsp;&nbsp;&nbsp;web2ldap\_pip\_extra\_args: "{{ aedir\_pip\_extra\_args }}"  
&nbsp;&nbsp;when: openldap\_role=="provider"

The role sets some vars that are used in later tasks.

If I execute the role itself before another role in the same playbook web2ldap's vars are  
present an can be used. But not with the include\_role task above.

Any hint what's going on is highly appreciated.

Ciao, Michael.

---

<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:** [May 29, 2017, 5:05am UTC](https://forum.ansible.com/t/use-vars-from-include-role/24578/2 "2017-05-29T05:05:31Z")

</div>

This was discussed in another thread. Seems to be a bug in the “include\_role” module

---

<div class="post-metadata">

**Author:** ![Michael\_Stroder](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@Michael\_Stroder](https://forum.ansible.com/u/Michael_Stroder)\
**Post date:** [May 29, 2017, 8:43am UTC](https://forum.ansible.com/t/use-vars-from-include-role/24578/3 "2017-05-29T08:43:25Z")

</div>

Trond Hindenes wrote:

> This was discussed in another thread. Seems to be a bug in the "include\_role" module

I already suspected that and abandoned the separate role and replaced the include\_role  
task with normal tasks.

Thanks for the confirmation.

Ciao, Michael.
