Add automatic restart for RabbitMQ
This patch ensures that systemd will restart RabbitMQ in case of failure or if the process is manually killed. Closes-Bug: 1659954 Change-Id: Id8dbdccfe445f4a25902054eb6809d42a92d5f5d
This commit is contained in:
parent
9f95b25476
commit
e27a4b2851
@ -60,10 +60,20 @@
|
||||
- rabbitmq-config
|
||||
|
||||
- name: Apply resource limits (systemd)
|
||||
register: rabbit_resource_limit_changed
|
||||
template:
|
||||
src: "limits.conf.j2"
|
||||
dest: "/etc/systemd/system/rabbitmq-server.service.d/limits.conf"
|
||||
register: rabbit_resource_limit
|
||||
when:
|
||||
- ansible_service_mgr == 'systemd'
|
||||
tags:
|
||||
- rabbitmq-config
|
||||
|
||||
- name: Add automatic restart on failure
|
||||
template:
|
||||
src: systemd-restart-on-failure.conf.j2
|
||||
dest: "/etc/systemd/system/rabbitmq-server.service.d/systemd-restart-on-failure.conf"
|
||||
register: rabbit_restart_on_failure
|
||||
when:
|
||||
- ansible_service_mgr == 'systemd'
|
||||
tags:
|
||||
@ -73,7 +83,8 @@
|
||||
command: "systemctl daemon-reload"
|
||||
when:
|
||||
- ansible_service_mgr == 'systemd'
|
||||
- rabbit_resource_limit_changed|changed
|
||||
- rabbit_resource_limit | changed
|
||||
- rabbit_restart_on_failure | changed
|
||||
tags:
|
||||
- rabbitmq-config
|
||||
# don't trigger ANSIBLE0016
|
||||
|
4
templates/systemd-restart-on-failure.conf.j2
Normal file
4
templates/systemd-restart-on-failure.conf.j2
Normal file
@ -0,0 +1,4 @@
|
||||
# {{ ansible_managed }}
|
||||
[Service]
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
Loading…
Reference in New Issue
Block a user