From a9d53dd9b89de628461a282e0b9ddc11ef02dcb1 Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Fri, 27 May 2016 20:44:26 +0200
Subject: [PATCH] ansible-playbooks/general#19 Set role header

---
 tasks/main.yml | 40 ++++++++++++++++++++++++----------------
 1 file changed, 24 insertions(+), 16 deletions(-)

diff --git a/tasks/main.yml b/tasks/main.yml
index 925aa6e..73cb870 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -1,21 +1,29 @@
 ---
 # file: roles/commonkeys/tasks/main.yml
 
-- name: "Reset all hosts"
-  include: reset.yml
-  with_items: '{{ groups.all }}'
-  loop_control:
-    loop_var: hostname
-  when: hostname != "localhost" and inventory_hostname != "localhost"
+- name: "Common Keys Role"
+  set_fact: role_commonkeys_started=true
+  tags: always
 
-- name: "Tunnel keys"
-  include: tunnel_keys.yml
+- block:
 
-- name: "User keys"
-  include: user_keys.yml
-  with_flattened:
-    - '{{ admins }}'
-    - '{{ jailusers }}'
-  loop_control:
-    loop_var: username
-  tags: 'Keys'
+  - name: "Reset all hosts"
+    include: reset.yml
+    with_items: '{{ groups.all }}'
+    loop_control:
+      loop_var: hostname
+    when: hostname != "localhost" and inventory_hostname != "localhost"
+
+  - name: "Tunnel keys"
+    include: tunnel_keys.yml
+
+  - name: "User keys"
+    include: user_keys.yml
+    with_flattened:
+      - '{{ admins }}'
+      - '{{ jailusers }}'
+    loop_control:
+      loop_var: username
+    tags: 'Keys'
+
+  when: '"commonkeys" not in excluded_roles'
-- 
GitLab