# include\_role with different user is not working

**URL:** <https://forum.ansible.com/t/include-role-with-different-user-is-not-working/27732>\
**Category:** Ansible Project\
**Created:** [June 7, 2018, 7:57am UTC](https://forum.ansible.com/t/include-role-with-different-user-is-not-working/27732 "2018-06-07T07:57:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SS1](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@SS1](https://forum.ansible.com/u/SS1)\
**Post date:** [June 7, 2018, 7:57am UTC](https://forum.ansible.com/t/include-role-with-different-user-is-not-working/27732/1 "2018-06-07T07:57:05Z")

</div>

Ansible Version 2.5.4

I have a playbook which include two different role. Playbook run on localhost as root using ansible-pull

role1. rpm installation require root access.  
role2. Application Configuration need to run as application user

Tries the role2 es-configure with become\_user and ansible\_user as below. Still the role execute as root

With become: yes

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [June 7, 2018, 10:01am UTC](https://forum.ansible.com/t/include-role-with-different-user-is-not-working/27732/2 "2018-06-07T10:01:43Z")

</div>

This give you the answers

[https://docs.ansible.com/ansible/2.5/porting\_guides/porting\_guide\_2.5.html#dynamic-includes-and-attribute-inheritance](https://docs.ansible.com/ansible/2.5/porting_guides/porting_guide_2.5.html#dynamic-includes-and-attribute-inheritance)

In the link they use tags but this is also true for become since that's also an attribute.

---

<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:** [June 7, 2018, 2:23pm UTC](https://forum.ansible.com/t/include-role-with-different-user-is-not-working/27732/3 "2018-06-07T14:23:01Z")

</div>

As an extension of the link Kai provided, you can use `block` to help you achieve your goal:

- block:
- include\_role:  
name: roles/elasticsearch/es-configure  
vars:  
version: “6.2.4”  
user: eseng  
group: eseng  
become: yes  
become\_user: eseng
