From 7abc41ee92b3ff592cfbfd4c0a74f7d1d5541c4e Mon Sep 17 00:00:00 2001 From: n0trax Date: Thu, 14 Dec 2017 19:45:27 +0100 Subject: [PATCH] Fix systemd service scripts (#12) --- roles/service-prometheus/README.md | 3 --- roles/service-prometheus/defaults/main.yml | 1 - roles/service-prometheus/tasks/main.yml | 1 - roles/service-prometheus/templates/alertmanager.service.j2 | 5 +++-- roles/service-prometheus/templates/node_exporter.service.j2 | 5 +++-- roles/service-prometheus/templates/prometheus.service.j2 | 5 +++-- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/roles/service-prometheus/README.md b/roles/service-prometheus/README.md index 2b7d0b2..4a69f0e 100644 --- a/roles/service-prometheus/README.md +++ b/roles/service-prometheus/README.md @@ -52,9 +52,6 @@ prometheus_install_path: /opt/prometheus # directory for configuration files prometheus_config_path: /etc/prometheus -# directory for PID files -prometheus_pid_path: /var/run/prometheus - # directory for temporary files prometheus_download_path: /tmp diff --git a/roles/service-prometheus/defaults/main.yml b/roles/service-prometheus/defaults/main.yml index c639e3e..69f62b6 100644 --- a/roles/service-prometheus/defaults/main.yml +++ b/roles/service-prometheus/defaults/main.yml @@ -21,7 +21,6 @@ prometheus_rule_path: "{{ prometheus_config_path }}/rules" prometheus_file_sd_config_path: "{{ prometheus_config_path }}/tgroups" prometheus_db_path: /var/lib/prometheus alertmanager_db_path: /var/lib/alertmanager -prometheus_pid_path: /var/run/prometheus prometheus_download_path: /tmp prometheus_workdir: "{{ prometheus_download_path }}/prometheus_workdir" diff --git a/roles/service-prometheus/tasks/main.yml b/roles/service-prometheus/tasks/main.yml index 4ed1092..5077ef9 100644 --- a/roles/service-prometheus/tasks/main.yml +++ b/roles/service-prometheus/tasks/main.yml @@ -24,7 +24,6 @@ with_items: - "{{ prometheus_install_path }}" - "{{ prometheus_config_path }}" - - "{{ prometheus_pid_path }}" - name: install helper utility "gosu" include_tasks: install-gosu.yml diff --git a/roles/service-prometheus/templates/alertmanager.service.j2 b/roles/service-prometheus/templates/alertmanager.service.j2 index 891e35f..155f88e 100644 --- a/roles/service-prometheus/templates/alertmanager.service.j2 +++ b/roles/service-prometheus/templates/alertmanager.service.j2 @@ -5,8 +5,6 @@ After=network.target [Service] Type=simple -PIDFile={{ prometheus_pid_path }}/alertmanager.pid - User={{ prometheus_user }} Group={{ prometheus_group }} @@ -16,3 +14,6 @@ ExecStart={{ alertmanager_daemon_dir }}/alertmanager {{ alertmanager_default_opt ExecStart={{ alertmanager_daemon_dir }}/alertmanager {{ alertmanager_default_opts }} {% endif %} ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/roles/service-prometheus/templates/node_exporter.service.j2 b/roles/service-prometheus/templates/node_exporter.service.j2 index abb2007..86f585a 100644 --- a/roles/service-prometheus/templates/node_exporter.service.j2 +++ b/roles/service-prometheus/templates/node_exporter.service.j2 @@ -5,8 +5,6 @@ After=network.target [Service] Type=simple -PIDFile={{ prometheus_pid_path }}/node_exporter.pid - User={{ prometheus_user }} Group={{ prometheus_group }} @@ -16,3 +14,6 @@ ExecStart={{ node_exporter_daemon_dir }}/node_exporter {{ node_exporter_opts }} ExecStart={{ node_exporter_daemon_dir }}/node_exporter {% endif %} ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/roles/service-prometheus/templates/prometheus.service.j2 b/roles/service-prometheus/templates/prometheus.service.j2 index f6773cb..f7cb88b 100644 --- a/roles/service-prometheus/templates/prometheus.service.j2 +++ b/roles/service-prometheus/templates/prometheus.service.j2 @@ -5,8 +5,6 @@ After=network.target [Service] Type=simple -PIDFile={{ prometheus_pid_path }}/prometheus.pid - User={{ prometheus_user }} Group={{ prometheus_group }} @@ -16,3 +14,6 @@ ExecStart={{ prometheus_daemon_dir }}/prometheus {{ prometheus_default_opts }} { ExecStart={{ prometheus_daemon_dir }}/prometheus {{ prometheus_default_opts }} {% endif %} ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target