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
|
||||
# limitations under the License.
|
||||
|
||||
- name: Reload the systemd daemon
|
||||
command: "systemctl daemon-reload"
|
||||
when:
|
||||
- pid1_name == "systemd"
|
||||
|
||||
- name: Restart memcached
|
||||
service:
|
||||
name: "memcached"
|
||||
|
@ -24,6 +24,18 @@
|
||||
tags:
|
||||
- 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
|
||||
tags:
|
||||
- memcached-install
|
||||
|
@ -40,7 +40,17 @@
|
||||
mode: "0644"
|
||||
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:
|
||||
src: "memcached.debian.j2"
|
||||
dest: "/etc/default/memcached"
|
||||
@ -49,9 +59,24 @@
|
||||
mode: "0644"
|
||||
when:
|
||||
- ansible_pkg_mgr == 'apt'
|
||||
- pid1_name != "systemd"
|
||||
- memcached_connections > 1024
|
||||
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
|
||||
lineinfile:
|
||||
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…
Reference in New Issue
Block a user