# How to pass 'become' to 'include\_\*' in ansible2.5

**URL:** <https://forum.ansible.com/t/how-to-pass-become-to-include-in-ansible2-5/27353>\
**Category:** Ansible Project\
**Created:** [April 23, 2018, 4:27pm UTC](https://forum.ansible.com/t/how-to-pass-become-to-include-in-ansible2-5/27353 "2018-04-23T16:27:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![profhase85](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@profhase85](https://forum.ansible.com/u/profhase85)\
**Post date:** [April 23, 2018, 4:27pm UTC](https://forum.ansible.com/t/how-to-pass-become-to-include-in-ansible2-5/27353/1 "2018-04-23T16:27:37Z")

</div>

Hi all, apparently attributes on include tasks are not propagated to the tasks anymore in 2.5

For some reasons i need dynamic includes.

> 1. How would I pass `become` to `include_role`

The usecase: When I develop a role, it is sometimes based on dynamic facts.

In my role I often use the following pattern:

`

# tasks/main.yml

- include\_tasks: preparation.yml

- include\_tasks: configuration.yml  
become: True

- include\_tasks: finish.yml  
become: True

`

As all of the tasks in `configuration.yml` require `become` And I am trying to avoid redundancy. On the other Hand I would not like people to have to include the role with a global `become` statement.

---

<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:** [April 23, 2018, 7:45pm UTC](https://forum.ansible.com/t/how-to-pass-become-to-include-in-ansible2-5/27353/2 "2018-04-23T19:45:36Z")

</div>

It's explained in the porting guide  
[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)

---

<div class="post-metadata">

**Author:** ![profhase85](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@profhase85](https://forum.ansible.com/u/profhase85)\
**Post date:** [April 24, 2018, 9:31am UTC](https://forum.ansible.com/t/how-to-pass-become-to-include-in-ansible2-5/27353/3 "2018-04-24T09:31:36Z")

</div>

Hi Kai, thank you i was not aware of that. it looks like an overhead, though (I would either have to introduce blocks in all my includes or type in ‘become’ for 10 times). I just don’t see any advantages in this separation, but well, this is probably OT.

Thanks,  
Ilya

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [April 24, 2018, 3:54pm UTC](https://forum.ansible.com/t/how-to-pass-become-to-include-in-ansible2-5/27353/4 "2018-04-24T15:54:16Z")

</div>

you should also be able to :

- block:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- include\_tasks ...  
&nbsp;&nbsp;become: yes

We ARE planning to add a 'bequeath' option to includes to allow  
directed keyword inheritance, but it is not ready yet.

---

<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:** [April 24, 2018, 4:00pm UTC](https://forum.ansible.com/t/how-to-pass-become-to-include-in-ansible2-5/27353/5 "2018-04-24T16:00:27Z")

</div>

Wrapping an include in a block to get that behavior is not functional in 2.5.0/2.5.1, but has been fixed for the 2.5.2 release.

---

<div class="post-metadata">

**Author:** ![profhase85](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@profhase85](https://forum.ansible.com/u/profhase85)\
**Post date:** [April 26, 2018, 8:16am UTC](https://forum.ansible.com/t/how-to-pass-become-to-include-in-ansible2-5/27353/6 "2018-04-26T08:16:32Z")

</div>

Thanks @Brian, this is good to know

Thanks @Matt - I will take that into account 🙂
