From 4c86cb9be208b9ed7bba67339249ad91e319f2cc Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Thu, 27 Sep 2018 00:13:27 -0500 Subject: [PATCH] Add changes to the sysconfig defaults file These changes mirror systemd tunables for elasticsearch and are needed to ensure any OS without systemd (like Ubuntu 14.04) has the same capabilities and OS's with systemd. This also adds a specific sysctl file to use when making sysctl changes. This will ensure we're not subjecting our deployment to other changes from other sources, like an OSA playbook run. Change-Id: Ic0e0bc0f93a12298c1e2f634cf5a1b4c6be2995e Signed-off-by: Kevin Carter --- .../roles/elastic_dependencies/tasks/main.yml | 2 ++ .../roles/elastic_logstash/tasks/main.yml | 9 +++++++++ .../roles/elastic_logstash/vars/redhat.yml | 2 ++ elk_metrics_6x/roles/elastic_logstash/vars/suse.yml | 2 ++ .../roles/elastic_logstash/vars/ubuntu.yml | 2 ++ elk_metrics_6x/roles/elasticsearch/tasks/main.yml | 13 +++++++++++++ elk_metrics_6x/roles/elasticsearch/vars/redhat.yml | 2 ++ elk_metrics_6x/roles/elasticsearch/vars/suse.yml | 2 ++ elk_metrics_6x/roles/elasticsearch/vars/ubuntu.yml | 2 ++ elk_metrics_6x/tests/functional.yml | 2 ++ 10 files changed, 38 insertions(+) diff --git a/elk_metrics_6x/roles/elastic_dependencies/tasks/main.yml b/elk_metrics_6x/roles/elastic_dependencies/tasks/main.yml index 1ee64e4a..2213efad 100644 --- a/elk_metrics_6x/roles/elastic_dependencies/tasks/main.yml +++ b/elk_metrics_6x/roles/elastic_dependencies/tasks/main.yml @@ -60,6 +60,7 @@ value: "524288" state: "present" reload: "yes" + sysctl_file: /etc/sysctl.d/99-elasticsearch.conf delegate_to: "{{ physical_host }}" tags: - sysctl @@ -70,6 +71,7 @@ value: "1048576" state: "present" reload: "yes" + sysctl_file: /etc/sysctl.d/99-elasticsearch.conf delegate_to: "{{ physical_host }}" tags: - sysctl diff --git a/elk_metrics_6x/roles/elastic_logstash/tasks/main.yml b/elk_metrics_6x/roles/elastic_logstash/tasks/main.yml index 1d7863da..c4b1e164 100644 --- a/elk_metrics_6x/roles/elastic_logstash/tasks/main.yml +++ b/elk_metrics_6x/roles/elastic_logstash/tasks/main.yml @@ -62,6 +62,15 @@ notify: - Enable and restart logstash +- name: Set sysconfig service defaults + lineinfile: + path: "{{ logstash_sysconfig_path }}" + regexp: '^{{ item.key }}=' + line: '{{ item.key }}={{ item.value }}' + with_items: + - key: LS_OPEN_FILES + value: 32768 + - name: Drop jvm conf file(s) template: src: "{{ item.src }}" diff --git a/elk_metrics_6x/roles/elastic_logstash/vars/redhat.yml b/elk_metrics_6x/roles/elastic_logstash/vars/redhat.yml index 716310e6..0d0e66ee 100644 --- a/elk_metrics_6x/roles/elastic_logstash/vars/redhat.yml +++ b/elk_metrics_6x/roles/elastic_logstash/vars/redhat.yml @@ -16,3 +16,5 @@ logstash_distro_packages: - logrotate - logstash + +logstash_sysconfig_path: /etc/default/logstash diff --git a/elk_metrics_6x/roles/elastic_logstash/vars/suse.yml b/elk_metrics_6x/roles/elastic_logstash/vars/suse.yml index 716310e6..0d0e66ee 100644 --- a/elk_metrics_6x/roles/elastic_logstash/vars/suse.yml +++ b/elk_metrics_6x/roles/elastic_logstash/vars/suse.yml @@ -16,3 +16,5 @@ logstash_distro_packages: - logrotate - logstash + +logstash_sysconfig_path: /etc/default/logstash diff --git a/elk_metrics_6x/roles/elastic_logstash/vars/ubuntu.yml b/elk_metrics_6x/roles/elastic_logstash/vars/ubuntu.yml index 716310e6..0d0e66ee 100644 --- a/elk_metrics_6x/roles/elastic_logstash/vars/ubuntu.yml +++ b/elk_metrics_6x/roles/elastic_logstash/vars/ubuntu.yml @@ -16,3 +16,5 @@ logstash_distro_packages: - logrotate - logstash + +logstash_sysconfig_path: /etc/default/logstash diff --git a/elk_metrics_6x/roles/elasticsearch/tasks/main.yml b/elk_metrics_6x/roles/elasticsearch/tasks/main.yml index 31962d02..78d9ecf4 100644 --- a/elk_metrics_6x/roles/elasticsearch/tasks/main.yml +++ b/elk_metrics_6x/roles/elasticsearch/tasks/main.yml @@ -68,6 +68,19 @@ tags: - config +- name: Set sysconfig service defaults + lineinfile: + path: "{{ elasticsearch_sysconfig_path }}" + regexp: '^{{ item.key }}=' + line: '{{ item.key }}={{ item.value }}' + with_items: + - key: MAX_OPEN_FILES + value: 65536 + - key: MAX_LOCKED_MEMORY + value: unlimited + - key: MAX_MAP_COUNT + value: 524288 + - name: Drop jvm conf file(s) template: src: "{{ item.src }}" diff --git a/elk_metrics_6x/roles/elasticsearch/vars/redhat.yml b/elk_metrics_6x/roles/elasticsearch/vars/redhat.yml index a5948d12..d80edade 100644 --- a/elk_metrics_6x/roles/elasticsearch/vars/redhat.yml +++ b/elk_metrics_6x/roles/elasticsearch/vars/redhat.yml @@ -16,3 +16,5 @@ elasticsearch_distro_packages: - logrotate - elasticsearch + +elasticsearch_sysconfig_path: /etc/sysconfig/elasticsearch diff --git a/elk_metrics_6x/roles/elasticsearch/vars/suse.yml b/elk_metrics_6x/roles/elasticsearch/vars/suse.yml index a5948d12..d80edade 100644 --- a/elk_metrics_6x/roles/elasticsearch/vars/suse.yml +++ b/elk_metrics_6x/roles/elasticsearch/vars/suse.yml @@ -16,3 +16,5 @@ elasticsearch_distro_packages: - logrotate - elasticsearch + +elasticsearch_sysconfig_path: /etc/sysconfig/elasticsearch diff --git a/elk_metrics_6x/roles/elasticsearch/vars/ubuntu.yml b/elk_metrics_6x/roles/elasticsearch/vars/ubuntu.yml index a5948d12..0fc5886a 100644 --- a/elk_metrics_6x/roles/elasticsearch/vars/ubuntu.yml +++ b/elk_metrics_6x/roles/elasticsearch/vars/ubuntu.yml @@ -16,3 +16,5 @@ elasticsearch_distro_packages: - logrotate - elasticsearch + +elasticsearch_sysconfig_path: /etc/default/elasticsearch diff --git a/elk_metrics_6x/tests/functional.yml b/elk_metrics_6x/tests/functional.yml index c0f283fe..c992e1b2 100644 --- a/elk_metrics_6x/tests/functional.yml +++ b/elk_metrics_6x/tests/functional.yml @@ -57,6 +57,8 @@ name: vm.swappiness value: 10 state: present + reload: "yes" + sysctl_file: /etc/sysctl.d/99-elasticsearch.conf - name: Flush iptables rules command: "{{ item }}"