Skip to content

Instantly share code, notes, and snippets.

@simcap
Created September 25, 2018 15:18
Show Gist options
  • Save simcap/9922a461a84299b49e298efaede6185e to your computer and use it in GitHub Desktop.
Save simcap/9922a461a84299b49e298efaede6185e to your computer and use it in GitHub Desktop.
Ansible Network VM boost
- name: Higher hard open file limits (needs restart done at the end)
lineinfile: path=/etc/security/limits.conf line="* hard nofile 1000000"
become: yes
- name: Higher soft open file limits (needs restart done at the end)
lineinfile: path=/etc/security/limits.conf line="* soft nofile 1000000"
become: yes
- name: Higher hard open file limits (needs restart done at the end)
lineinfile: path=/etc/security/limits.conf line="root hard nofile 1000000"
become: yes
- name: Higher soft open file limits (needs restart done at the end)
lineinfile: path=/etc/security/limits.conf line="root soft nofile 1000000"
become: yes
- name: Higher common sessions
lineinfile: path=/etc/pam.d/common-session line="session required pam_limits.so"
become: yes
- name: Higher common non interactive sessions
lineinfile: path=/etc/pam.d/common-session-noninteractive line="session required pam_limits.so"
become: yes
- name: Set ip_local_port_range
lineinfile: path=/etc/sysctl.conf line="net.ipv4.ip_local_port_range=1024 65535" regexp=^net\.ipv4\.ip_local_port_range
become: yes
- name: Set tcp_mem
lineinfile: path=/etc/sysctl.conf line="net.ipv4.tcp_mem=1000000 1000000 1000000" regexp=^net\.ipv4\.tcp_mem
become: yes
- name: Set tcp_rmem
lineinfile: path=/etc/sysctl.conf line="net.ipv4.tcp_rmem=1024 4096 16384" regexp=^net\.ipv4\.tcp_rmem
become: yes
- name: Set tcp_wmem
lineinfile: path=/etc/sysctl.conf line="net.ipv4.tcp_wmem=1024 4096 16384" regexp=^net\.ipv4\.tcp_wmem
become: yes
- name: Set rmem_max
lineinfile: path=/etc/sysctl.conf line="net.core.rmem_max=16384" regexp=^net\.core\.rmem_max
become: yes
- name: Set wmem_max
lineinfile: path=/etc/sysctl.conf line="net.core.wmem_max=16384" regexp=^net\.core\.wmem_max
become: yes
- name: Set file-max
lineinfile: path=/etc/sysctl.conf line="fs.file-max=1000000" regexp=^fs\.file-max
become: yes
- name: Set nr_open
lineinfile: path=/etc/sysctl.conf line="fs.nr_open=1000000" regexp=^fs\.nr_open
become: yes
- name: Apply sysctl
command: sysctl -p
become: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment