From aa2bf3f65b6ea76048448c792e5483b0a6a88f75 Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Wed, 8 Nov 2017 12:02:46 +0100
Subject: [PATCH] ansible-playbooks/general#72 All includes are now
 include_tasks and they always have a tag associated

---
 tasks/collect_config/commit/gitflow.yml |  3 ++-
 tasks/collect_config/main.yml           | 11 +++++++----
 tasks/install.yml                       | 18 ++++++++++--------
 tasks/main.yml                          |  5 +++--
 tasks/mysql.yml                         |  2 +-
 5 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/tasks/collect_config/commit/gitflow.yml b/tasks/collect_config/commit/gitflow.yml
index 5e4a66f..0d2e9f1 100644
--- a/tasks/collect_config/commit/gitflow.yml
+++ b/tasks/collect_config/commit/gitflow.yml
@@ -1,4 +1,5 @@
 ---
 # file: roles/drupal/tasks/config_collect/commit/gitflow.yml
 
-- import_tasks: 'git.yml'
+- include_tasks: 'git.yml'
+  tags: 'always'
diff --git a/tasks/collect_config/main.yml b/tasks/collect_config/main.yml
index 6922b49..3f1ab42 100644
--- a/tasks/collect_config/main.yml
+++ b/tasks/collect_config/main.yml
@@ -11,7 +11,7 @@
       pathExport='{{ export_path }}'
       pathWorking='/tmp/ansible-cae-{{ drupal.jail.name }}-{{ version }}'
       collectConfig={{ drupal.src.collectConfig|default([]) }}
-  tags: always
+  tags: 'always'
 
 - name: "Check if export path exists"
   stat:
@@ -20,7 +20,8 @@
 
 - block:
 
-  - import_tasks: 'prepare/{{ collectConfig.mode|default("none") }}.yml'
+  - include_tasks: 'prepare/{{ collectConfig.mode|default("none") }}.yml'
+    tags: 'always'
 
   - name: "Move exported config to working copy"
     command: 'mv {{ pathExport }} {{ pathWorking }}'
@@ -36,9 +37,11 @@
       remote_src: yes
     with_items: '{{ list_config_files.stdout_lines }}'
 
-  - import_tasks: 'commit/{{ collectConfig.mode|default("none") }}.yml'
+  - include_tasks: 'commit/{{ collectConfig.mode|default("none") }}.yml'
+    tags: 'always'
 
-  - import_tasks: 'finish/{{ collectConfig.mode|default("none") }}.yml'
+  - include_tasks: 'finish/{{ collectConfig.mode|default("none") }}.yml'
+    tags: 'always'
 
   - name: "Delete working copy"
     file:
diff --git a/tasks/install.yml b/tasks/install.yml
index b174f39..72f7c16 100644
--- a/tasks/install.yml
+++ b/tasks/install.yml
@@ -21,7 +21,7 @@
       relativeRoot='{{ drupal.relativeRoot|default(drupal_links_relative_root) }}'
       drupalRoot='{{ webRoot }}{{ drupal.root|default("") }}'
       docRoot='{{ webRoot }}{{ drupal.docroot|default(drupal.root|default("")) }}'
-  tags: always
+  tags: 'always'
 
 - name: "Configure Apache"
   include_tasks: apache.yml
@@ -56,19 +56,21 @@
   - set_fact: drupal_first_installation=false
   - set_fact: drupal_first_installation=true
     when: drupal_install_drupal and drupal_available is defined and drupal_available.stdout != [drupalRoot, '/index.php']|join('')
-  tags: always
+  tags: 'always'
 
-- import_tasks: install/{{ installSource.mode|default("none") }}.yml
+- include_tasks: install/{{ installSource.mode|default("none") }}.yml
   when: drupal_first_installation
+  tags: 'always'
 
-- import_tasks: install/{{ drupal.version|default("d7") }}.yml
+- include_tasks: install/{{ drupal.version|default("d7") }}.yml
   when: drupal_first_installation
+  tags: 'always'
 
-- import_tasks: deploy/{{ installSource.mode|default("none") }}.yml
+- include_tasks: deploy/{{ installSource.mode|default("none") }}.yml
   when: drupal_install_drupal
   tags: 'deploy'
 
-- import_tasks: deploy/{{ drupal.version|default("d7") }}.yml
+- include_tasks: deploy/{{ drupal.version|default("d7") }}.yml
   when: drupal_install_drupal
   tags: 'deploy'
 
@@ -86,7 +88,7 @@
     loop_var: scss_dir
   tags: 'deploy'
 
-- import_tasks: users/{{ installSource.mode|default("none") }}.yml
+- include_tasks: users/{{ installSource.mode|default("none") }}.yml
   when: drupal_install_drupal and drupal.src is defined and drupal.src.name is defined
   tags: 'SetPermissions'
 
@@ -152,7 +154,7 @@
   with_items: '{{ drupal.domains }}'
   when: item.install|default(true)
 
-- import_tasks: deploy/finalize_{{ drupal.version|default("d7") }}.yml
+- include_tasks: deploy/finalize_{{ drupal.version|default("d7") }}.yml
   when: drupal_install_drupal
   tags: 'deploy'
 
diff --git a/tasks/main.yml b/tasks/main.yml
index 85f9a60..214d12bf 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -3,7 +3,7 @@
 
 - name: "Drupal Role"
   set_fact: role_drupal_started=true
-  tags: always
+  tags: 'always'
 
 - block:
   - name: "Install Certs"
@@ -25,6 +25,7 @@
     loop_control:
       loop_var: drupal
     when: limit_site is not defined or drupal.id is not defined or limit_site == drupal.id
+    tags: 'deploy'
 
   when: '"drupal" not in excluded_roles and drupal_install_drupal and (collect_config is not defined or not collect_config)'
 
@@ -34,7 +35,7 @@
     with_items: '{{ drupal_settings }}'
     loop_control:
       loop_var: drupal
-    tags: 'deploy'
     when: limit_site is not defined or drupal.id is not defined or limit_site == drupal.id
+    tags: 'deploy'
 
   when: '"drupal" not in excluded_roles and drupal_install_drupal and collect_config is defined and collect_config'
diff --git a/tasks/mysql.yml b/tasks/mysql.yml
index 8375fcc..832f4b0 100644
--- a/tasks/mysql.yml
+++ b/tasks/mysql.yml
@@ -6,7 +6,7 @@
     extra={{ drupal_domain.db.extra|default([]) }}
     external={{ drupal_domain.db.external|default([]) }}
     external_hosts={{ drupal_domain.db.external_hosts|default([]) }}
-  tags: always
+  tags: 'always'
 
 - name: "Ensure Database"
   mysql_db:
-- 
GitLab