mirror of
https://github.com/aljazceru/ansible-elasticsearch.git
synced 2025-12-18 09:34:20 +01:00
Added support for optionally creating the elasticsearch user and group before installing elasticsearch.
Renamed vars, set the tasks to use the es_user and es_group vars in elasticsearch-optional-user.yml. Modifed README.md to list the es_user_id and es_group_id vars, made note that both vars are required if they are used. Removed the commented out instances of the vars in defaults/main.yml. Added es_user, es_group, es_user_id, es_group_id vars to config testing. Made conditionals use explicit 'is defined' test. Add tests for es_user_id and es_group_id. Update defaults/main.yml and test/integration/config.yml to match master plus test config additions.
This commit is contained in:
18
tasks/elasticsearch-optional-user.yml
Normal file
18
tasks/elasticsearch-optional-user.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
#Add the elasticsearch user before installing from packages.
|
||||
- name: Ensure optional elasticsearch group is created with the correct id.
|
||||
group:
|
||||
state: present
|
||||
name: "{{ es_group }}"
|
||||
system: yes
|
||||
gid: "{{ es_group_id }}"
|
||||
|
||||
- name: Ensure optional elasticsearch user is created with the correct id.
|
||||
user:
|
||||
state: present
|
||||
name: "{{ es_user }}"
|
||||
comment: elasticsearch system user
|
||||
system: yes
|
||||
createhome: no
|
||||
uid: "{{ es_user_id }}"
|
||||
group: "{{ es_group }}"
|
||||
@@ -8,6 +8,10 @@
|
||||
|
||||
- debug: msg="Node configuration {{ es_config }} "
|
||||
|
||||
- name: Include optional user and group creation.
|
||||
when: (es_user_id is defined) and (es_group_id is defined)
|
||||
include: elasticsearch-optional-user.yml
|
||||
|
||||
#- name: Include specific Elasticsearch
|
||||
# include: "elasticsearch-{{ansible_os_family}}.yml"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user