Merge branch 'activate-elasticsearch-license' of https://github.com/barryib/ansible-elasticsearch into barryib-activate-elasticsearch-license

This commit is contained in:
Dale McDiarmid 2017-01-04 11:00:40 +00:00
commit 6768a15b89
7 changed files with 55 additions and 2 deletions

View file

@ -0,0 +1,36 @@
---
- name: Activate ES license (without shield authentication)
uri:
method: PUT
url: "http://{{es_api_host}}:{{es_api_port}}/_xpack/license?acknowledge=true"
body_format: json
body: "{{ es_xpack_license }}"
return_content: yes
register: license_activated
no_log: True
when: '"shield" not in es_xpack_features
failed_when: >
license_activated.status != 200 or
license_activated.json.license_status is not defined or
license_activated.json.license_status != 'valid'
- name: Activate ES license (with shield authentication)
uri:
method: PUT
url: "http://{{es_api_host}}:{{es_api_port}}/_xpack/license?acknowledge=true"
user: "{{es_api_basic_auth_username}}"
password: "{{es_api_basic_auth_password}}"
body_format: json
force_basic_auth: yes
body: "{{ es_xpack_license }}"
return_content: yes
register: license_activated
no_log: True
when: '"shield" in es_xpack_features
failed_when: >
license_activated.status != 200 or
license_activated.json.license_status is not defined or
license_activated.json.license_status != 'valid'
- debug:
msg: "License: {{ license_activated.content }}"

View file

@ -14,7 +14,7 @@
#Remove Plugin if installed and its not been requested or the ES version has changed
- name: Remove {{item}} plugin
command: >
{{es_home}}/bin/plugin remove shield
{{es_home}}/bin/plugin remove {{item}}
register: xpack_state
failed_when: "'ERROR' in xpack_state.stdout"
changed_when: xpack_state.rc == 0

View file

@ -49,7 +49,10 @@
#Shield configuration
- include: shield/elasticsearch-shield.yml
#Add any feature specific configuration here
# Activate ES lience
- include: elasticsearch-xpack-activation.yml
when: es_enable_xpack and es_xpack_license is defined and es_xpack_license != ''
#Add any feature specific configuration here
- name: Set Plugin Directory Permissions
file: state=directory path={{ es_home }}/plugins owner={{ es_user }} group={{ es_group }} recurse=yes

View file

@ -37,6 +37,7 @@
{{es_home}}/bin/shield/esusers useradd {{item}} -p {{es_users.file[item].password}}
with_items: "{{users_to_add | default([])}}"
when: manage_file_users and users_to_add | length > 0
no_log: True
environment:
CONF_DIR: "{{ conf_dir }}"
ES_HOME: "{{es_home}}"
@ -49,6 +50,7 @@
when: manage_file_users and es_users.file.keys() | length > 0
#Currently no easy way to figure out if the password has changed or to know what it currently is so we can skip.
changed_when: False
no_log: True
environment:
CONF_DIR: "{{ conf_dir }}"
ES_HOME: "{{es_home}}"