Skip to content

Instantly share code, notes, and snippets.

@eyasuyuki
Last active June 15, 2020 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eyasuyuki/5d1f7b560bdc81be6511 to your computer and use it in GitHub Desktop.
Save eyasuyuki/5d1f7b560bdc81be6511 to your computer and use it in GitHub Desktop.
Ansible playbook example before install Fluentd
- hosts: all
remote_user: eyasuyuki
sudo: yes
vars:
limits_conf: /etc/security/limits.conf
sysctl_conf: /etc/sysctl.conf
tasks:
- name: before install fluentd check ulimit
shell: grep "{{ item }}" {{ limits_conf }}
with_items:
- "root soft nofile 65536"
- "root hard nofile 65536"
- "* soft nofile 65536"
- "* hard nofile 65536"
register: result
ignore_errors: yes
- name: before install fluentd set ulimit
shell: echo '{{ item.item }}' >> {{ limits_conf }}
with_items: result.results
when: item.rc == 1
- name: before install fluentd check sysctl
shell: grep "{{ item }}" {{ sysctl_conf }}
with_items:
- "net.ipv4.tcp_tw_recycle = 1"
- "net.ipv4.tcp_tw_reuse = 1"
- "net.ipv4.ip_local_port_range = 10240 65535"
register: result
ignore_errors: yes
- name: before install fluentd set sysctl
shell: echo '{{ item.item }}' >> {{ sysctl_conf }}
with_items: result.results
when: item.rc == 1
- name: before install fluentd sysctl restart
command: /sbin/sysctl -w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment