"Monitor" service via systemd
This commit is contained in:
parent
719fc93598
commit
65a0d4046e
5 changed files with 23 additions and 21 deletions
4
files/systemd/override.conf
Normal file
4
files/systemd/override.conf
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Ansible managed
|
||||
|
||||
[Service]
|
||||
Restart=always
|
|
@ -8,12 +8,11 @@
|
|||
name: nginx
|
||||
state: reloaded
|
||||
|
||||
- name: reload monit
|
||||
ansible.builtin.service:
|
||||
name: monit
|
||||
state: reloaded
|
||||
|
||||
- name: reload fail2ban
|
||||
ansible.builtin.service:
|
||||
name: fail2ban
|
||||
state: reloaded
|
||||
|
||||
- name: Reload systemd
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: true
|
||||
|
|
|
@ -46,3 +46,18 @@
|
|||
mode: "0644"
|
||||
notify: reload nginx
|
||||
when: nginx_type == 'gateway' or nginx_type == 'standalone'
|
||||
|
||||
- name: "Configuration | Create systemd override directory"
|
||||
ansible.builtin.file:
|
||||
path: /etc/systemd/system/nginx.service.d
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: "Configuration | Copy systemd override configuration"
|
||||
ansible.builtin.copy:
|
||||
src: systemd/override.conf
|
||||
dest: /etc/systemd/system/nginx.service.d/override.conf
|
||||
mode: "0644"
|
||||
notify:
|
||||
- Reload systemd
|
||||
- reload nginx
|
||||
|
|
|
@ -23,11 +23,3 @@
|
|||
dest: /etc/nginx/sites-enabled/local-statistics
|
||||
state: link
|
||||
notify: reload nginx
|
||||
|
||||
- name: "Monitoring | Copy Monit configuration"
|
||||
ansible.builtin.template:
|
||||
src: monit.j2
|
||||
dest: /etc/monit/conf-enabled/nginx
|
||||
mode: 0644
|
||||
notify: reload monit
|
||||
when: "'monit' in ansible_facts.packages"
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
check process nginx with pidfile /var/run/nginx.pid
|
||||
group webserver
|
||||
start program = "/usr/sbin/service nginx start"
|
||||
stop program = "/usr/sbin/service nginx stop"
|
||||
if failed host 127.0.0.1 port {{ nginx_port | default(80) }} for 3 cycles then restart
|
||||
if 5 restarts with 5 cycles then timeout
|
Loading…
Reference in a new issue