Adjust file descriptor limit when systemd is used
Change-Id: I29629ba3c78a55ebd63e4f9710ba71b85c488279 Related-Bug: #1623164
This commit is contained in:
parent
815bc8a7d7
commit
04941492c3
@ -13,6 +13,11 @@
|
|||||||
# 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: Reload the systemd daemon
|
||||||
|
command: "systemctl daemon-reload"
|
||||||
|
when:
|
||||||
|
- pid1_name == "systemd"
|
||||||
|
|
||||||
- name: Restart memcached
|
- name: Restart memcached
|
||||||
service:
|
service:
|
||||||
name: "memcached"
|
name: "memcached"
|
||||||
|
@ -24,6 +24,18 @@
|
|||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
|
||||||
|
- name: Check init system
|
||||||
|
command: cat /proc/1/comm
|
||||||
|
register: _pid1_name
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
|
- name: Set the name of pid1
|
||||||
|
set_fact:
|
||||||
|
pid1_name: "{{ _pid1_name.stdout }}"
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
- include: memcached_install.yml
|
- include: memcached_install.yml
|
||||||
tags:
|
tags:
|
||||||
- memcached-install
|
- memcached-install
|
||||||
|
@ -40,7 +40,17 @@
|
|||||||
mode: "0644"
|
mode: "0644"
|
||||||
notify: Restart memcached
|
notify: Restart memcached
|
||||||
|
|
||||||
- name: Apply resource limits
|
- name: Create memcached systemd service config dir
|
||||||
|
file:
|
||||||
|
path: "/etc/systemd/system/memcached.service.d"
|
||||||
|
state: "directory"
|
||||||
|
group: "root"
|
||||||
|
owner: "root"
|
||||||
|
mode: "0755"
|
||||||
|
when:
|
||||||
|
- pid1_name == "systemd"
|
||||||
|
|
||||||
|
- name: Apply resource limits (upstart)
|
||||||
template:
|
template:
|
||||||
src: "memcached.debian.j2"
|
src: "memcached.debian.j2"
|
||||||
dest: "/etc/default/memcached"
|
dest: "/etc/default/memcached"
|
||||||
@ -49,9 +59,24 @@
|
|||||||
mode: "0644"
|
mode: "0644"
|
||||||
when:
|
when:
|
||||||
- ansible_pkg_mgr == 'apt'
|
- ansible_pkg_mgr == 'apt'
|
||||||
|
- pid1_name != "systemd"
|
||||||
- memcached_connections > 1024
|
- memcached_connections > 1024
|
||||||
notify: Restart memcached
|
notify: Restart memcached
|
||||||
|
|
||||||
|
- name: Apply resource limits (systemd)
|
||||||
|
template:
|
||||||
|
src: "limits.conf.j2"
|
||||||
|
dest: "/etc/systemd/system/memcached.service.d/limits.conf"
|
||||||
|
owner: "root"
|
||||||
|
group: "root"
|
||||||
|
mode: "0644"
|
||||||
|
when:
|
||||||
|
- pid1_name == "systemd"
|
||||||
|
- memcached_connections > 1024
|
||||||
|
notify:
|
||||||
|
- Reload the systemd daemon
|
||||||
|
- Restart memcached
|
||||||
|
|
||||||
- name: Configure soft file limits
|
- name: Configure soft file limits
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: "/etc/security/limits.conf"
|
dest: "/etc/security/limits.conf"
|
||||||
|
4
templates/limits.conf.j2
Normal file
4
templates/limits.conf.j2
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
LimitNOFILE={{ memcached_connections }}
|
Loading…
x
Reference in New Issue
Block a user