Hi,
I noticed that while:
include_role:
name: myrole
delegate_to: somehost
will not delegate the included role, this will:
block:
include_role:
name: myrole
delegate_to: somehost
Is this by design, i.e. I may rely on it, or is this a fluke that may get ‘fixed’ in future releases?
Best regards,
Tim
By delegating the included role I mean delegating the tasks inside the role and any more included/imported by that role or even tasks of roles the role depends on (I tested this on ansible 2.7.10).
Analog for tags it turns out that:
block:
include_role:
name: myrole
tags: mytag
will apply the tag to tasks inside the role, its dependencies, roles that it includes/imports. Is this too a feature?
The block trick also works for include_tasks and import_tasks for both setting tags and delegate_to.
sivel
(sivel)
May 4, 2019, 11:38pm
4
This is expected. There is documentation to this effect at
https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_2.5.html#dynamic-includes-and-attribute-inheritance
As of Ansible 2.7 see the “apply” argument to include_tasks and include_role to do what you want.