allow to deploy custom config files
This commit is contained in:
parent
8d13c69d88
commit
04438f9110
2 changed files with 64 additions and 8 deletions
|
|
@ -20,6 +20,9 @@ es_templates: false
|
||||||
es_user: elasticsearch
|
es_user: elasticsearch
|
||||||
es_group: elasticsearch
|
es_group: elasticsearch
|
||||||
es_config: {}
|
es_config: {}
|
||||||
|
es_config_default: ""
|
||||||
|
es_config_log4j2: ""
|
||||||
|
es_config_jvm: ""
|
||||||
#Need to provide default directories
|
#Need to provide default directories
|
||||||
es_conf_dir: "/etc/elasticsearch"
|
es_conf_dir: "/etc/elasticsearch"
|
||||||
es_pid_dir: "/var/run/elasticsearch"
|
es_pid_dir: "/var/run/elasticsearch"
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,32 @@
|
||||||
#Create conf directory
|
#Create conf directory
|
||||||
- name: Create Configuration Directory
|
- name: Create Configuration Directory
|
||||||
become: yes
|
become: yes
|
||||||
file: path={{ es_conf_dir }} state=directory owner=root group={{ es_group }} mode=2750
|
file:
|
||||||
|
path: "{{ es_conf_dir }}"
|
||||||
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: "{{ es_group }}"
|
||||||
|
mode: 2750
|
||||||
|
|
||||||
#Create pid directory
|
#Create pid directory
|
||||||
- name: Create PID Directory
|
- name: Create PID Directory
|
||||||
become: yes
|
become: yes
|
||||||
file: path={{ es_pid_dir }} state=directory owner={{ es_user }} group={{ es_group }} mode=0755
|
file:
|
||||||
|
path: "{{ es_pid_dir }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ es_user }}"
|
||||||
|
group: "{{ es_group }}"
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
#Create required directories
|
#Create required directories
|
||||||
- name: Create Others Directories
|
- name: Create Others Directories
|
||||||
become: yes
|
become: yes
|
||||||
file: path={{ item }} state=directory owner={{ es_user }} group={{ es_group }} mode=2750
|
file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ es_user }}"
|
||||||
|
group: "{{ es_group }}"
|
||||||
|
mode: 2750
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ es_log_dir }}"
|
- "{{ es_log_dir }}"
|
||||||
- "{{ es_data_dirs }}"
|
- "{{ es_data_dirs }}"
|
||||||
|
|
@ -22,14 +37,26 @@
|
||||||
#Copy the config template
|
#Copy the config template
|
||||||
- name: Copy Configuration File
|
- name: Copy Configuration File
|
||||||
become: yes
|
become: yes
|
||||||
template: src=elasticsearch.yml.j2 dest={{ es_conf_dir }}/elasticsearch.yml owner=root group={{ es_group }} mode=0660 force=yes
|
template:
|
||||||
|
src: elasticsearch.yml.j2
|
||||||
|
dest: "{{ es_conf_dir }}/elasticsearch.yml"
|
||||||
|
owner: root
|
||||||
|
group: "{{ es_group }}"
|
||||||
|
mode: 0660
|
||||||
|
force: yes
|
||||||
register: system_change
|
register: system_change
|
||||||
notify: restart elasticsearch
|
notify: restart elasticsearch
|
||||||
|
|
||||||
#Copy the default file
|
#Copy the default file
|
||||||
- name: Copy Default File
|
- name: Copy Default File
|
||||||
become: yes
|
become: yes
|
||||||
template: src=elasticsearch.j2 dest={{ default_file }} owner=root group={{ es_group }} mode=0660 force=yes
|
template:
|
||||||
|
src: "{% if es_config_default != '' %}{{ es_config_default }}{% else %}elasticsearch.j2{% endif %}"
|
||||||
|
dest: "{{ default_file }}"
|
||||||
|
owner: root
|
||||||
|
group: "{{ es_group }}"
|
||||||
|
mode: 0660
|
||||||
|
force: yes
|
||||||
notify: restart elasticsearch
|
notify: restart elasticsearch
|
||||||
|
|
||||||
#Copy the systemd specific file if systemd is installed
|
#Copy the systemd specific file if systemd is installed
|
||||||
|
|
@ -37,15 +64,41 @@
|
||||||
become: yes
|
become: yes
|
||||||
block:
|
block:
|
||||||
- name: Make sure destination dir exists
|
- name: Make sure destination dir exists
|
||||||
file: path={{ sysd_config_file | dirname }} state=directory mode=0755
|
file:
|
||||||
|
path: "{{ sysd_config_file | dirname }}"
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
- name: Copy specific ElasticSearch Systemd config file
|
- name: Copy specific ElasticSearch Systemd config file
|
||||||
ini_file: path={{ sysd_config_file }} section=Service option=LimitMEMLOCK value=infinity mode=0644
|
ini_file:
|
||||||
|
path: "{{ sysd_config_file }}"
|
||||||
|
section: Service
|
||||||
|
option: LimitMEMLOCK
|
||||||
|
value: infinity
|
||||||
|
mode: 0644
|
||||||
notify:
|
notify:
|
||||||
- reload systemd configuration
|
- reload systemd configuration
|
||||||
- restart elasticsearch
|
- restart elasticsearch
|
||||||
|
|
||||||
- name: Copy jvm.options File
|
- name: Copy jvm.options File
|
||||||
become: yes
|
become: yes
|
||||||
template: src=jvm.options.j2 dest={{ es_conf_dir }}/jvm.options owner=root group={{ es_group }} mode=0660 force=yes
|
template:
|
||||||
|
src: "{% if es_config_jvm != '' %}{{ es_config_jvm }}{% else %}jvm.options.j2{% endif %}"
|
||||||
|
dest: "{{ es_conf_dir }}/jvm.options"
|
||||||
|
owner: root
|
||||||
|
group: "{{ es_group }}"
|
||||||
|
mode: 0660
|
||||||
|
force: yes
|
||||||
notify: restart elasticsearch
|
notify: restart elasticsearch
|
||||||
|
|
||||||
|
- name: Copy log4j2.properties File
|
||||||
|
become: yes
|
||||||
|
template:
|
||||||
|
src: "{{ es_config_log4j2 }}"
|
||||||
|
dest: "{{ es_conf_dir }}/log4j2.properties"
|
||||||
|
owner: root
|
||||||
|
group: "{{ es_group }}"
|
||||||
|
mode: 0660
|
||||||
|
force: yes
|
||||||
|
notify: restart elasticsearch
|
||||||
|
when: es_config_log4j2 != ''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue