Merge branch 'feature-es-cluster-check-fix'
This commit is contained in:
commit
75f1669ca8
@ -5,95 +5,94 @@
|
|||||||
- generate_certs
|
- generate_certs
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
|
- import_tasks: RedHat.yml
|
||||||
|
when: ansible_os_family == 'RedHat'
|
||||||
|
|
||||||
- import_tasks: RedHat.yml
|
- name: Install OpenDistro
|
||||||
when: ansible_os_family == 'RedHat'
|
package:
|
||||||
|
name: opendistroforelasticsearch-{{ opendistro_version }}
|
||||||
|
state: present
|
||||||
|
register: install
|
||||||
|
tags: install
|
||||||
|
|
||||||
|
- name: Remove elasticsearch configuration file
|
||||||
|
file:
|
||||||
|
path: "{{ opendistro_conf_path }}/elasticsearch.yml"
|
||||||
|
state: absent
|
||||||
|
when: install.changed
|
||||||
|
tags: install
|
||||||
|
|
||||||
- name: Install OpenDistro
|
- name: Copy Configuration File
|
||||||
package:
|
blockinfile:
|
||||||
name: opendistroforelasticsearch-{{ opendistro_version }}
|
block: "{{ lookup('template', 'elasticsearch.yml.j2') }}"
|
||||||
state: present
|
dest: "{{ opendistro_conf_path }}/elasticsearch.yml"
|
||||||
register: install
|
create: true
|
||||||
tags: install
|
group: elasticsearch
|
||||||
|
mode: 0640
|
||||||
|
marker: "## {mark} Opendistro general settings ##"
|
||||||
|
when: install.changed
|
||||||
|
tags: install
|
||||||
|
|
||||||
- name: Remove elasticsearch configuration file
|
- include_tasks: security_actions.yml
|
||||||
file:
|
tags:
|
||||||
path: "{{ opendistro_conf_path }}/elasticsearch.yml"
|
- security
|
||||||
state: absent
|
when: install.changed
|
||||||
when: install.changed
|
|
||||||
tags: install
|
|
||||||
|
|
||||||
- name: Copy Configuration File
|
- name: Configure OpenDistro Elasticsearch JVM memmory.
|
||||||
blockinfile:
|
template:
|
||||||
block: "{{ lookup('template', 'elasticsearch.yml.j2') }}"
|
src: "templates/jvm.options.j2"
|
||||||
dest: "{{ opendistro_conf_path }}/elasticsearch.yml"
|
dest: /etc/elasticsearch/jvm.options
|
||||||
create: true
|
owner: root
|
||||||
group: elasticsearch
|
group: elasticsearch
|
||||||
mode: 0640
|
mode: 0644
|
||||||
marker: "## {mark} Opendistro general settings ##"
|
force: yes
|
||||||
when: install.changed
|
notify: restart elasticsearch
|
||||||
tags: install
|
tags: install
|
||||||
|
|
||||||
- include_tasks: security_actions.yml
|
- name: Ensure Elasticsearch started and enabled
|
||||||
tags:
|
service:
|
||||||
- security
|
name: elasticsearch
|
||||||
when: install.changed
|
enabled: true
|
||||||
|
state: started
|
||||||
|
|
||||||
- name: Configure OpenDistro Elasticsearch JVM memmory.
|
- name: Wait for Elasticsearch API
|
||||||
template:
|
uri:
|
||||||
src: "templates/jvm.options.j2"
|
url: "https://{{ inventory_hostname }}:{{ opendistro_http_port }}/_cluster/health/"
|
||||||
dest: /etc/elasticsearch/jvm.options
|
user: "admin" # Default OpenDistro user is always "admin"
|
||||||
owner: root
|
password: "{{ opendistro_admin_password }}"
|
||||||
group: elasticsearch
|
validate_certs: no
|
||||||
mode: 0644
|
status_code: 200,401
|
||||||
force: yes
|
return_content: yes
|
||||||
notify: restart elasticsearch
|
timeout: 4
|
||||||
tags: install
|
register: _result
|
||||||
|
until:
|
||||||
|
- _result.json is defined
|
||||||
|
- _result.json.status == "green" or ( _result.json.status == "yellow" and single_node )
|
||||||
|
retries: 24
|
||||||
|
delay: 5
|
||||||
|
tags: debug
|
||||||
|
when:
|
||||||
|
- hostvars[inventory_hostname]['private_ip'] is not defined or not hostvars[inventory_hostname]['private_ip']
|
||||||
|
|
||||||
- name: Ensure Elasticsearch started and enabled
|
- name: Wait for Elasticsearch API (Private IP)
|
||||||
service:
|
uri:
|
||||||
name: elasticsearch
|
url: "https://{{ hostvars[inventory_hostname]['private_ip'] }}:{{ opendistro_http_port }}/_cluster/health/"
|
||||||
enabled: true
|
user: "admin" # Default OpenDistro user is always "admin"
|
||||||
state: started
|
password: "{{ opendistro_admin_password }}"
|
||||||
|
validate_certs: no
|
||||||
- name: Wait for Elasticsearch API
|
status_code: 200,401
|
||||||
uri:
|
return_content: yes
|
||||||
url: "https://{{ inventory_hostname }}:{{ opendistro_http_port }}/_cluster/health/"
|
timeout: 4
|
||||||
user: "admin" # Default OpenDistro user is always "admin"
|
register: _result
|
||||||
password: "{{ opendistro_admin_password }}"
|
until:
|
||||||
validate_certs: no
|
- _result.json is defined
|
||||||
status_code: 200,401
|
- _result.json.status == "green" or ( _result.json.status == "yellow" and single_node )
|
||||||
return_content: yes
|
retries: 24
|
||||||
timeout: 4
|
delay: 5
|
||||||
register: _result
|
tags: debug
|
||||||
until: ( _result.json is defined) and (_result.json.status == "green")
|
when:
|
||||||
retries: 24
|
- hostvars[inventory_hostname]['private_ip'] is defined and hostvars[inventory_hostname]['private_ip']
|
||||||
delay: 5
|
|
||||||
tags: debug
|
|
||||||
when:
|
|
||||||
- hostvars[inventory_hostname]['private_ip'] is not defined or not hostvars[inventory_hostname]['private_ip']
|
|
||||||
- single_node == false
|
|
||||||
|
|
||||||
- name: Wait for Elasticsearch API (Private IP)
|
|
||||||
uri:
|
|
||||||
url: "https://{{ hostvars[inventory_hostname]['private_ip'] }}:{{ opendistro_http_port }}/_cluster/health/"
|
|
||||||
user: "admin" # Default OpenDistro user is always "admin"
|
|
||||||
password: "{{ opendistro_admin_password }}"
|
|
||||||
validate_certs: no
|
|
||||||
status_code: 200,401
|
|
||||||
return_content: yes
|
|
||||||
timeout: 4
|
|
||||||
register: _result
|
|
||||||
until: ( _result.json is defined) and (_result.json.status == "green")
|
|
||||||
retries: 24
|
|
||||||
delay: 5
|
|
||||||
tags: debug
|
|
||||||
when:
|
|
||||||
- hostvars[inventory_hostname]['private_ip'] is defined and hostvars[inventory_hostname]['private_ip']
|
|
||||||
- single_node == false
|
|
||||||
|
|
||||||
- import_tasks: "RMRedHat.yml"
|
|
||||||
when: ansible_os_family == "RedHat"
|
|
||||||
|
|
||||||
|
- import_tasks: "RMRedHat.yml"
|
||||||
|
when: ansible_os_family == "RedHat"
|
||||||
when: perform_installation
|
when: perform_installation
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user