Selaa lähdekoodia

Make possible to deploy sysctl.d configuration with custom variables

Emmanuel Bouthenot 11 vuotta sitten
vanhempi
commit
edb2c79013

+ 3 - 0
roles/common/handlers/base.yml

@@ -1,5 +1,8 @@
 - name: Reload apt cache
   action: command apt-get update
 
+- name: Apply kernel variables
+  action: service name=procps state=restarted
+
 - name: Update motd
   action: shell toilet -f future ${ansible_fqdn} > /var/run/motd && echo >> /var/run/motd && uname -snrvm >> /var/run/motd && echo >> /var/run/motd

+ 7 - 0
roles/common/tasks/base.yml

@@ -36,6 +36,13 @@
 - name: Install hosts.deny file
   action: template src=hosts.deny.j2 dest=/etc/hosts.deny owner=root group=root mode=0644
 
+- name: Install kernel configuration
+  action: template src=kernel/sysctl.d/${item} dest=/etc/sysctl.d/${item} owner=root group=root mode=0644
+  with_items:
+      - 10-increase-file-descriptors.conf
+  notify:
+    - Apply kernel variables
+
 - name: Install sudo configuration
   action: template src=sudo/local-admin.j2 dest=/etc/sudoers.d/local-admin owner=root group=root mode=0440
 

+ 8 - 0
roles/common/templates/kernel/sysctl.d/10-increase-file-descriptors.conf

@@ -0,0 +1,8 @@
+#
+# sysctl: File descriptors configuration
+#
+
+net.core.somaxconn = 32768
+net.core.netdev_max_backlog = 32768
+net.ipv4.tcp_max_syn_backlog = 1024
+