Hello,

I have a question concerning the *become* directive and *include_tasks*. 
After Ansible upgrade to 2.5 the become directive is not escalated to 
included tasks. 

I'm aware of 
https://docs.ansible.com/ansible/2.5/porting_guides/porting_guide_2.5.html#dynamic-includes-and-attribute-inheritance,
 
especially:

All attributes applied to a dynamic include_* would only apply to the 
> include itself, while attributes applied to a static import_* would be 
> inherited by the tasks within.


Hence my question is whether "attributes" word involves also the become 
directive(s) or it is a bug?

This new behaviour makes upgrade much harder than expected and become for 
include_tasks itself doesn't make a sense.

Thank you
Petr

$ ansible --version
ansible 2.5.0
  python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 
20160609]

$ cat whoami-playbook.yml 
---
- name: playbook to check escalation of become
  hosts: localhost
  connection: local
  tasks:
    - name: become include_tasks
      include_tasks: whoami.yml
      become: yes


    - name: become import_tasks
      import_tasks: whoami.yml
      become: yes


$ cat whoami.yml 
---
- name: ask whoami
  command: whoami
  register: whoami


- debug: var=whoami.stdout


$ ansible-playbook whoami-playbook.yml 


PLAY [playbook to check propagation of become] 
***********************************************************************************************************************************************************************************************


TASK [Gathering Facts] 
***********************************************************************************************************************************************************************************************************************
ok: [localhost]


TASK [become include_tasks] 
******************************************************************************************************************************************************************************************************************
included: /home/casta/Archive/Projects/sandpit-ansible/whoami.yml for 
localhost


TASK [ask whoami] 
****************************************************************************************************************************************************************************************************************************
changed: [localhost]


TASK [debug] 
*********************************************************************************************************************************************************************************************************************************
ok: [localhost] => {
    "whoami.stdout": "casta"
}


TASK [ask whoami] 
****************************************************************************************************************************************************************************************************************************
changed: [localhost]


TASK [debug] 
*********************************************************************************************************************************************************************************************************************************
ok: [localhost] => {
    "whoami.stdout": "root"
}


PLAY RECAP 
***********************************************************************************************************************************************************************************************************************************
localhost                  : ok=6    changed=2    unreachable=0    failed=0 
  



-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/309f9746-d6d3-4fbf-bd18-5fb3ac788464%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to