From 9f97ecef03b2e88fae4f328616f5333dde804d43 Mon Sep 17 00:00:00 2001 From: Benjamin Brahmer Date: Sat, 21 Dec 2024 11:17:32 +0100 Subject: [PATCH] some fixes --- roles/prometheus/files/node_exporter.service | 2 +- roles/prometheus/tasks/download.yml | 7 ------- roles/prometheus/tasks/main.yml | 11 +++++++++++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/roles/prometheus/files/node_exporter.service b/roles/prometheus/files/node_exporter.service index a9a645b..268d78b 100644 --- a/roles/prometheus/files/node_exporter.service +++ b/roles/prometheus/files/node_exporter.service @@ -5,7 +5,7 @@ After=network-online.target [Service] User=prometheus -ExecStart=/opt/node_exporter/node_exporter -–collector.systemd –-collector.processes --web.listen-address=127.0.0.1:9100 +ExecStart=/opt/node_exporter/node_exporter --collector.systemd --collector.processes --web.listen-address=127.0.0.1:9100 [Install] WantedBy=default.target \ No newline at end of file diff --git a/roles/prometheus/tasks/download.yml b/roles/prometheus/tasks/download.yml index 8b707f9..0754215 100644 --- a/roles/prometheus/tasks/download.yml +++ b/roles/prometheus/tasks/download.yml @@ -55,10 +55,3 @@ group: prometheus mode: '0744' state: file - -- name: Start node_exporter service - ansible.builtin.systemd: - daemon-reload: true - enabled: true - name: node_exporter - state: restarted diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml index d98dbb9..60619a8 100644 --- a/roles/prometheus/tasks/main.yml +++ b/roles/prometheus/tasks/main.yml @@ -6,6 +6,10 @@ owner: root group: root +- name: Reload systemd + ansible.builtin.systemd: + daemon-reload: true + - name: Add prometheus system user for node_exporter ansible.builtin.user: name: prometheus @@ -25,3 +29,10 @@ - name: Check if node_exporter-adv needs to be installed or upgraded ansible.builtin.include_tasks: download.yml when: installed_node_exporter_version.stdout != node_exporter_version + +- name: Start node_exporter service + ansible.builtin.systemd: + daemon-reload: true + enabled: true + name: node_exporter + state: restarted