Use systemd_service role for overrides
Replace placing templates for systemd overrides with systemd_service role, that will handle overrides for us in more convenient and unified way. Change-Id: I2759b1949e9ecc98953f414c6f9838aed7dd8499
This commit is contained in:
parent
e707eecdd8
commit
8271919b17
@ -284,6 +284,12 @@ rabbitmq_port_bindings:
|
|||||||
tcp_listeners:
|
tcp_listeners:
|
||||||
"0.0.0.0": 5672
|
"0.0.0.0": 5672
|
||||||
|
|
||||||
|
rabbitmq_init_overrides:
|
||||||
|
Service:
|
||||||
|
LimitNOFILE: "{{ rabbitmq_ulimit }}"
|
||||||
|
Restart: on-failure
|
||||||
|
RestartSec: 2
|
||||||
|
|
||||||
# Mnesia configuration
|
# Mnesia configuration
|
||||||
# The Mnesia dump_log_write_threshold option controls
|
# The Mnesia dump_log_write_threshold option controls
|
||||||
# how often the dumping occurs
|
# how often the dumping occurs
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Added variable ``rabbitmq_init_overrides`` that allows to control rabbitmq
|
||||||
|
overrides that will be applied to the systemd service.
|
||||||
|
Previously values were hardcoded without possibility for override.
|
@ -13,16 +13,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- name: Create rabbitmq systemd service config dir
|
|
||||||
file:
|
|
||||||
path: "/etc/systemd/system/rabbitmq-server.service.d"
|
|
||||||
state: "directory"
|
|
||||||
group: "root"
|
|
||||||
owner: "root"
|
|
||||||
mode: "0755"
|
|
||||||
tags:
|
|
||||||
- rabbitmq-config
|
|
||||||
|
|
||||||
- name: Create rabbitmq config
|
- name: Create rabbitmq config
|
||||||
register: rabbit_config
|
register: rabbit_config
|
||||||
template:
|
template:
|
||||||
@ -45,32 +35,26 @@
|
|||||||
path: /etc/rabbitmq/rabbitmq.config
|
path: /etc/rabbitmq/rabbitmq.config
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Apply resource limits (systemd)
|
# TODO(noonedeadpunk): Remove task after Z release
|
||||||
template:
|
- name: Remove old systemd overrides
|
||||||
src: "limits.conf.j2"
|
file:
|
||||||
dest: "/etc/systemd/system/rabbitmq-server.service.d/limits.conf"
|
path: "/etc/systemd/system/rabbitmq-server.service.d/{{ item }}"
|
||||||
register: rabbit_resource_limit
|
state: absent
|
||||||
tags:
|
with_items:
|
||||||
- rabbitmq-config
|
- limits.conf
|
||||||
|
- systemd-restart-on-failure.conf
|
||||||
|
when: rabbitmq_upgrade | bool
|
||||||
|
|
||||||
- name: Add automatic restart on failure
|
- name: Apply systemctl overrides
|
||||||
template:
|
import_role:
|
||||||
src: systemd-restart-on-failure.conf.j2
|
name: systemd_service
|
||||||
dest: "/etc/systemd/system/rabbitmq-server.service.d/systemd-restart-on-failure.conf"
|
vars:
|
||||||
register: rabbit_restart_on_failure
|
systemd_user_name: "{{ rabbit_system_user_name }}"
|
||||||
tags:
|
systemd_group_name: "{{ rabbit_system_group_name }}"
|
||||||
- rabbitmq-config
|
systemd_services:
|
||||||
|
- service_name: rabbitmq-server
|
||||||
- name: Reload the systemd daemon
|
systemd_overrides_only: true
|
||||||
systemd:
|
systemd_overrides: "{{ rabbitmq_init_overrides }}"
|
||||||
daemon_reload: yes
|
|
||||||
when:
|
|
||||||
- rabbit_resource_limit is changed
|
|
||||||
- rabbit_restart_on_failure is changed
|
|
||||||
tags:
|
|
||||||
- rabbitmq-config
|
|
||||||
# don't trigger ANSIBLE0016
|
|
||||||
- skip_ansible_lint
|
|
||||||
|
|
||||||
- name: Configure rabbitmq plugins
|
- name: Configure rabbitmq plugins
|
||||||
community.rabbitmq.rabbitmq_plugin:
|
community.rabbitmq.rabbitmq_plugin:
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
# {{ ansible_managed }}
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
LimitNOFILE={{ rabbitmq_ulimit }}
|
|
@ -1,18 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=RabbitMQ broker
|
|
||||||
After=syslog.target network.target
|
|
||||||
Conflicts=epmd.socket
|
|
||||||
Conflicts=epmd.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=notify
|
|
||||||
User={{ rabbit_system_user_name }}
|
|
||||||
Group={{ rabbit_system_group_name }}
|
|
||||||
LimitNOFILE=65535
|
|
||||||
NotifyAccess=all
|
|
||||||
WorkingDirectory=/var/lib/rabbitmq
|
|
||||||
ExecStart=/usr/sbin/rabbitmq-server
|
|
||||||
ExecStop=/usr/sbin/rabbitmqctl stop
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
@ -1,4 +0,0 @@
|
|||||||
# {{ ansible_managed }}
|
|
||||||
[Service]
|
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=2
|
|
Loading…
Reference in New Issue
Block a user