From 2f819d61bfa62e596b2d29f011eaeac899282980 Mon Sep 17 00:00:00 2001 From: BeansIsFat <24848012+BeansIsFat@users.noreply.github.com> Date: Thu, 31 Mar 2022 10:40:29 -0400 Subject: [PATCH] Add tag inheritance to post-provision tasks (#146) Imported tasks inherit tags but Included tasks don't. This leads to confusion because included tasks need to have an explicit tag added or they won't run. This is the workaround provided and [documented](https://docs.ansible.com/ansible/latest/user_guide/playbooks_tags.html#tag-inheritance-for-includes-blocks-and-the-apply-keyword) by Ansible to add tag inheritance to included tasks. --- main.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main.yml b/main.yml index e5b7213..0004094 100644 --- a/main.yml +++ b/main.yml @@ -45,9 +45,10 @@ when: configure_sublime tags: ['sublime-text'] - - name: Run configured post-provision ansible task files. - include_tasks: "{{ outer_item }}" - loop_control: - loop_var: outer_item - with_fileglob: "{{ post_provision_tasks|default(omit) }}" + - block: + - name: Run configured post-provision ansible task files. + include_tasks: "{{ outer_item }}" + loop_control: + loop_var: outer_item + with_fileglob: "{{ post_provision_tasks|default(omit) }}" tags: ['post']