1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- ---
- - name: Create redis group
- group:
- name: redis
- state: present
- gid: 8000
- - name: Create redis user
- user:
- name: redis
- group: redis
- uid: 8000
- shell: /usr/sbin/nologin
- state: present
- - name: Soft file ulimit for redis user
- lineinfile:
- path: /etc/security/limits.conf
- regexp: '^redis\s+soft\s+nofile\s+65000'
- line: "redis soft nofile 65000"
- - name: Hard file ulimit for redis user
- lineinfile:
- path: /etc/security/limits.conf
- regexp: '^redis\s+hard\s+nofile\s+65000'
- line: "redis hard nofile 65000"
- # TODO: change this to check the value first
- - name: Setup RPS
- shell: "echo '1' > /sys/class/net/{{ ansible_default_ipv4.interface }}/queues/rx-0/rps_cpus"
- # TODO: change this to check the value first
- - name: Disable transparent hugepages
- shell: "echo 'never' > /sys/kernel/mm/transparent_hugepage/enabled"
- - name: Ensure redis-tools are installed
- package:
- name: redis-tools
- state: present
- - name: Sysctl Settings
- sysctl:
- name: "{{item.name}}"
- value: "{{item.value}}"
- reload: yes
- with_items:
- - { name: "vm.swappiness", value: "0"}
- - { name: "net.ipv4.tcp_sack", value: "1"}
- - { name: "net.ipv4.tcp_timestamps", value: "1"}
- - { name: "net.ipv4.tcp_window_scaling", value: "1"}
- - { name: "net.ipv4.tcp_congestion_control", value: "cubic"}
- - { name: "net.ipv4.tcp_syncookies", value: "1"}
- - { name: "net.ipv4.tcp_tw_recycle", value: "1"}
- - { name: "net.ipv4.tcp_max_syn_backlog", value: "1024"}
- - { name: "net.core.somaxconn", value: "1024"}
- - { name: "net.core.rmem_max", value: "425984"}
- - { name: "net.core.wmem_max", value: "425984"}
- - name: Set hostname
- hostname:
- name: "{{ inventory_hostname }}"
- - name: Set /etc/hosts
- lineinfile:
- path: /etc/hosts
- regexp: "{{inventory_hostname}}"
- line: "127.0.0.1 {{inventory_hostname}}"
- owner: root
- group: root
- mode: 0644
|