Control restart via systemd
This commit is contained in:
parent
387ddb8106
commit
1eb01f7c00
4 changed files with 29 additions and 19 deletions
|
@ -1,8 +0,0 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
check process grafana with pidfile /var/run/grafana/grafana-server.pid
|
||||
group monitor
|
||||
start program = "/bin/systemctl start grafana-server.service"
|
||||
stop program = "/bin/systemctl stop grafana-server.service"
|
||||
if failed host localhost port 3000 with timeout 15 seconds for 3 times within 4 cycles then restart
|
||||
if 5 restarts with 5 cycles then timeout
|
8
files/systemd/override.conf
Normal file
8
files/systemd/override.conf
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Ansible managed
|
||||
|
||||
[Unit]
|
||||
StartLimitIntervalSec=6
|
||||
StartLimitBurst=10
|
||||
|
||||
[Service]
|
||||
Restart=always
|
|
@ -1,10 +1,7 @@
|
|||
---
|
||||
- name: restart grafana
|
||||
ansible.builtin.service:
|
||||
- name: Restart grafana-server
|
||||
ansible.builtin.systemd:
|
||||
name: grafana-server
|
||||
state: restarted
|
||||
|
||||
- name: reload monit
|
||||
ansible.builtin.service:
|
||||
name: monit
|
||||
state: reloaded
|
||||
daemon_reload: true
|
||||
enabled: true
|
||||
|
|
|
@ -1,19 +1,32 @@
|
|||
---
|
||||
- name: "Grafana | Aktivere und starte Service"
|
||||
- name: "Configuration | Aktivere und starte Service"
|
||||
ansible.builtin.systemd:
|
||||
name: grafana-server
|
||||
enabled: true
|
||||
state: started
|
||||
daemon_reload: true
|
||||
|
||||
- name: "Grafana | Erzeuge Grafana-Konfiguration"
|
||||
- name: "Configuration | Erzeuge Grafana-Konfiguration"
|
||||
ansible.builtin.template:
|
||||
src: grafana.ini
|
||||
dest: /etc/grafana/grafana.ini
|
||||
mode: "0640"
|
||||
notify: restart grafana
|
||||
notify: Restart grafana-server
|
||||
|
||||
- name: "Grafana | Installiere Image Renderer Module"
|
||||
- name: "Configuration | Installiere Image Renderer Module"
|
||||
ansible.builtin.command:
|
||||
cmd: grafana-cli plugins install grafana-image-renderer
|
||||
creates: /var/lib/grafana/plugins/grafana-image-renderer
|
||||
|
||||
- name: "Configuration | Create systemd override directory"
|
||||
ansible.builtin.file:
|
||||
path: /etc/systemd/system/grafana-server.service.d
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: "Configuration | Copy systemd override configuration"
|
||||
ansible.builtin.copy:
|
||||
src: systemd/override.conf
|
||||
dest: /etc/systemd/system/grafana-server.service.d
|
||||
mode: "0644
|
||||
notify: Restart grafana-server
|
||||
|
|
Loading…
Reference in a new issue