From 716494ee8660737925cc625cee9e74d633b4d942 Mon Sep 17 00:00:00 2001 From: Paulo Matias Date: Tue, 13 Sep 2016 19:14:28 -0300 Subject: [PATCH] Adjust file descriptor limit when systemd is used Change-Id: I1039463e860e613f56fb2b813078d2c134f6b65d Related-Bug: #1623164 --- tasks/rabbitmq_post_install.yml | 30 ++++++++++++++++++++++++++++++ templates/limits.conf.j2 | 4 ++++ 2 files changed, 34 insertions(+) create mode 100644 templates/limits.conf.j2 diff --git a/tasks/rabbitmq_post_install.yml b/tasks/rabbitmq_post_install.yml index 3255ccb4..93f5ddc3 100644 --- a/tasks/rabbitmq_post_install.yml +++ b/tasks/rabbitmq_post_install.yml @@ -35,6 +35,18 @@ - rabbitmq-config - rabbitmq-cluster +- name: Create rabbitmq systemd service config dir + file: + path: "/etc/systemd/system/rabbitmq-server.service.d" + state: "directory" + group: "root" + owner: "root" + mode: "0755" + when: + - pid1_name == "systemd" + tags: + - rabbitmq-config + - name: Create rabbitmq config register: rabbit_config_changed template: @@ -47,6 +59,24 @@ tags: - 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" + when: + - pid1_name == "systemd" + tags: + - rabbitmq-config + +- name: Reload the systemd daemon + command: "systemctl daemon-reload" + when: + - pid1_name == "systemd" + - rabbit_resource_limit_changed|changed + tags: + - rabbitmq-config + - include: rabbitmq_restart.yml when: rabbit_config_changed|changed or rabbitmq_plugin|changed or rabbitmq_queue_mirror|changed diff --git a/templates/limits.conf.j2 b/templates/limits.conf.j2 new file mode 100644 index 00000000..94e8ab65 --- /dev/null +++ b/templates/limits.conf.j2 @@ -0,0 +1,4 @@ +# {{ ansible_managed }} + +[Service] +LimitNOFILE={{ rabbitmq_ulimit }}