From c8e279695f74e592f9829a691c51bc43733e3cc8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20Krupa?= <pawel@krupa.net.pl>
Date: Mon, 17 Dec 2018 16:18:47 +0100
Subject: [PATCH] Better tags and configuration handling (#66)

---
 tasks/configure.yml |  9 +++++++++
 tasks/install.yml   |  9 ---------
 tasks/main.yml      | 15 +++++++++------
 3 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/tasks/configure.yml b/tasks/configure.yml
index 97375b0..ae684c3 100644
--- a/tasks/configure.yml
+++ b/tasks/configure.yml
@@ -1,4 +1,13 @@
 ---
+- name: Copy the Node Exporter systemd service file
+  template:
+    src: node_exporter.service.j2
+    dest: /etc/systemd/system/node_exporter.service
+    owner: root
+    group: root
+    mode: 0644
+  notify: restart node_exporter
+
 - name: Create texfile collector dir
   file:
     path: "{{ node_exporter_textfile_dir }}"
diff --git a/tasks/install.yml b/tasks/install.yml
index 5ab0ce2..c4294b0 100644
--- a/tasks/install.yml
+++ b/tasks/install.yml
@@ -58,12 +58,3 @@
     group: "{{ node_exporter_system_group }}"
   notify: restart node_exporter
   when: not ansible_check_mode
-
-- name: Copy the Node Exporter systemd service file
-  template:
-    src: node_exporter.service.j2
-    dest: /etc/systemd/system/node_exporter.service
-    owner: root
-    group: root
-    mode: 0644
-  notify: restart node_exporter
diff --git a/tasks/main.yml b/tasks/main.yml
index aaf0de1..ade82e7 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -6,22 +6,25 @@
     - "{{ ansible_distribution | lower }}.yml"
     - "{{ ansible_os_family | lower }}.yml"
   tags:
-    - always
+    - node_exporter_install
+    - node_exporter_configure
+    - node_exporter_run
 
 - import_tasks: preflight.yml
   tags:
-    - install
-    - configure
+    - node_exporter_install
+    - node_exporter_configure
+    - node_exporter_run
 
 - import_tasks: install.yml
   become: true
   tags:
-    - install
+    - node_exporter_install
 
 - import_tasks: configure.yml
   become: true
   tags:
-    - configure
+    - node_exporter_configure
 
 - name: Ensure Node Exporter is enabled on boot
   become: true
@@ -30,4 +33,4 @@
     name: node_exporter
     enabled: true
   tags:
-    - run
+    - node_exporter_run
-- 
GitLab