Support for removing mlock + max open files + fix to documentation error
This commit is contained in:
parent
b2997cc0bc
commit
d7d144b638
3 changed files with 29 additions and 9 deletions
|
|
@ -112,7 +112,6 @@ An example of a two server deployment, each with 1 node on one server and 2 node
|
|||
es_templates: false
|
||||
es_version_lock: false
|
||||
es_cluster_name: test-cluster
|
||||
m_lock_enabled: true
|
||||
ansible_user: ansible
|
||||
es_plugins:
|
||||
- plugin: elasticsearch/license
|
||||
|
|
@ -128,7 +127,6 @@ An example of a two server deployment, each with 1 node on one server and 2 node
|
|||
es_templates: false
|
||||
es_version_lock: false
|
||||
es_cluster_name: test-cluster
|
||||
m_lock_enabled: false
|
||||
ansible_user: ansible
|
||||
es_plugins:
|
||||
- plugin: elasticsearch/license
|
||||
|
|
|
|||
|
|
@ -43,12 +43,19 @@
|
|||
when: es_heap_size is defined
|
||||
register: elasticsearch_configure
|
||||
|
||||
#We only have to set these if they are specified. The start scripts will by default use the NAME set later on constructing directory names to avoid collisions.
|
||||
- debug: msg="{{elasticsearch_configure}}"
|
||||
|
||||
#We only have to set these if they are specified. The start scripts will by default set this value.
|
||||
- name: Configure max open files
|
||||
lineinfile: dest={{instance_default_file}} regexp="^MAX_OPEN_FILES" insertafter="^#MAX_OPEN_FILES" line="MAX_OPEN_FILES={{ es_max_open_files }}"
|
||||
when: es_max_open_files is defined
|
||||
register: elasticsearch_configure
|
||||
|
||||
#If the setting is not specified we remove it if its present. This will mean it reverts to the value in the init script.
|
||||
- name: Remove max open files
|
||||
lineinfile: dest={{instance_default_file}} regexp="^MAX_OPEN_FILES" line="MAX_OPEN_FILES=" state=absent
|
||||
when: es_max_open_files is not defined
|
||||
register: elasticsearch_configure
|
||||
|
||||
#For directories we also use the {{inventory_hostname}}-{{ es_instance_name }} - this helps if we have a shared SAN.
|
||||
|
||||
|
|
@ -117,20 +124,37 @@
|
|||
when: instance_init_script != init_script
|
||||
|
||||
- file: path={{instance_config_directory}}/logging.yml state=touch owner={{ es_user }} group={{ es_group }}
|
||||
changed_when: false
|
||||
|
||||
- set_fact: m_lock_enabled={{ es_config['bootstrap.mlockall'] is defined and es_config['bootstrap.mlockall'] == True }}
|
||||
|
||||
#Configure mlock if enabled
|
||||
- name: Configure mlock
|
||||
lineinfile: dest={{instance_default_file}} regexp="^MAX_LOCKED_MEMORY" insertafter="^#MAX_LOCKED_MEMORY" line="MAX_LOCKED_MEMORY=unlimited"
|
||||
when: es_config['bootstrap.mlockall'] is defined and es_config['bootstrap.mlockall'] == True
|
||||
when: m_lock_enabled
|
||||
register: elasticsearch_configure
|
||||
|
||||
#Change for systemd setting to ensure mlock is achieved
|
||||
#Removed mlock if not enabled and present
|
||||
- name: Remove mlock
|
||||
lineinfile: dest={{instance_default_file}} regexp="^MAX_LOCKED_MEMORY" line="MAX_LOCKED_MEMORY=unlimited" state=absent
|
||||
when: not m_lock_enabled
|
||||
|
||||
- stat: path=/usr/lib/systemd/system/elasticsearch.service
|
||||
register: systemd_service
|
||||
when: es_config['bootstrap.mlockall'] is defined and es_config['bootstrap.mlockall'] == True
|
||||
when: m_lock_enabled
|
||||
|
||||
#Change for systemd setting to ensure mlock is achieved
|
||||
- name: Configure systemd
|
||||
lineinfile: dest=/usr/lib/systemd/system/elasticsearch.service regexp="^LimitMEMLOCK" insertafter="^#LimitMEMLOCK" line="LimitMEMLOCK=infinity"
|
||||
when: es_config['bootstrap.mlockall'] is defined and es_config['bootstrap.mlockall'] == True and systemd_service.stat.exists == True
|
||||
when: m_lock_enabled and systemd_service.stat.exists == True
|
||||
register: elasticsearch_configure
|
||||
|
||||
#Remove setting if mlock is disabled
|
||||
- name: Remove systemd
|
||||
lineinfile: dest=/usr/lib/systemd/system/elasticsearch.service regexp="^LimitMEMLOCK" line="LimitMEMLOCK=infinity" state=absent
|
||||
when: not m_lock_enabled
|
||||
|
||||
- debug: msg="{{m_lock_enabled}}"
|
||||
|
||||
|
||||
- debug: msg="{{elasticsearch_configure}}"
|
||||
|
|
@ -19,8 +19,6 @@
|
|||
- name: Elasticsearch configuration
|
||||
include: elasticsearch-config.yml
|
||||
|
||||
#We remove the node.name key as it may be set by another node on the same server
|
||||
|
||||
|
||||
# Make sure the service is started, and restart if necessary
|
||||
- name: Start elasticsearch service
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue