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.
$ ansible --versionansible 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 ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
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.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
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.
--
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD8N0v_-%2BY4PYapymT9dtZd2Tiydx9utd%3DKmnx0vmPSUVfGWzg%40mail.gmail.com.