Merge conflicts

This commit is contained in:
Dale McDiarmid 2017-01-06 10:59:16 +00:00
commit 2062e85d14
13 changed files with 245 additions and 22 deletions

View file

@ -51,6 +51,18 @@
- name: Copy Logging.yml File for Instance
template: src=logging.yml.j2 dest={{conf_dir}}/logging.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
notify: restart elasticsearch
when: es_version | version_compare('5.0', '<')
- name: Copy log4j2.properties File for Instance
template: src=log4j2.properties.j2 dest={{conf_dir}}/log4j2.properties owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
notify: restart elasticsearch
when: es_version | version_compare('5.0', '>=')
# Copy the JVM Options (5.x only)
- name: Copy jvm.options File for Instance
template: src=jvm.options.j2 dest={{conf_dir}}/jvm.options owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
notify: restart elasticsearch
when: es_version | version_compare('5.0', '>=')
#Clean up un-wanted package scripts to avoid confusion
@ -74,3 +86,8 @@
- name: Delete Default Logging File
file: dest=/etc/elasticsearch/logging.yml state=absent
- name: Delete Default Logging File (5.x)
file: dest=/etc/elasticsearch/log4j2.properties state=absent
- name: Delete Default JVM Options File (5.x)
file: dest=/etc/elasticsearch/jvm.options state=absent

View file

@ -18,8 +18,8 @@
when: not multi_cast and es_config['discovery.zen.ping.unicast.hosts'] is not defined
#If the user attempts to lock memory they must specify a heap size
- fail: msg="If locking memory with bootstrap.mlockall a heap size must be specified"
when: es_config['bootstrap.mlockall'] is defined and es_config['bootstrap.mlockall'] == True and es_heap_size is not defined
- fail: msg="If locking memory with bootstrap.mlockall (or bootstrap.memory_lock) a heap size must be specified"
when: (es_config['bootstrap.mlockall'] is defined or es_config['bootstrap.memory_lock'] is defined) and es_config['bootstrap.mlockall'] == True and es_heap_size is not defined
#Don't support xpack on versions < 2.0
- fail: msg="Use of the xpack notation is not supported on versions < 2.0. Marvel-agent and watcher can be installed as plugins. Version > 2.0 is required for shield."
@ -32,7 +32,7 @@
- set_fact: instance_default_file={{default_file | dirname}}/{{es_instance_name}}_{{default_file | basename}}
- set_fact: instance_init_script={{init_script | dirname }}/{{es_instance_name}}_{{init_script | basename}}
- set_fact: conf_dir={{ es_conf_dir }}/{{es_instance_name}}
- set_fact: m_lock_enabled={{ es_config['bootstrap.mlockall'] is defined and es_config['bootstrap.mlockall'] == True }}
- set_fact: m_lock_enabled={{ (es_config['bootstrap.mlockall'] is defined and es_config['bootstrap.mlockall'] == True) or (es_config['bootstrap.memory_lock'] is defined and es_config['bootstrap.memory_lock'] == True) }}
#Use systemd for the following distributions:
#Ubuntu 15 and up

View file

@ -11,7 +11,8 @@
when: es_version | version_compare('2.0', '<')
#List currently installed plugins - ignore xpack if > v 2.0
- shell: "{{es_home}}/bin/plugin {{list_command}} | sed -n '1!p' | cut -d '-' -f2-{% if es_version | version_compare('2.0', '>') %} | grep -vE '{{supported_xpack_features | join('|')}}|license'{% endif %}"
- name: Check installed elasticsearch plugins
shell: "{{es_home}}/bin/{{ es_binary_prefix }}plugin {{list_command}}{% if es_version | version_compare('5.0', '<') %} | sed -n '1!p' | cut -d '-' -f2-{% endif %}{% if es_version | version_compare('2.0', '>') %} | grep -vE '{{supported_xpack_features | join('|')}}|license'{% endif %}"
register: installed_plugins
failed_when: "'ERROR' in installed_plugins.stdout"
changed_when: False
@ -20,22 +21,21 @@
CONF_DIR: "{{ conf_dir }}"
ES_INCLUDE: "{{ instance_default_file }}"
#This needs to removes any currently installed plugins
# This removes any currently installed plugins (to prevent errors when reinstalling)
- name: Remove elasticsearch plugins
command: "{{es_home}}/bin/plugin remove {{item}} --silent"
command: "{{es_home}}/bin/{{ es_binary_prefix }}plugin remove {{item}} --silent"
ignore_errors: yes
with_items: "{{ installed_plugins.stdout_lines | default([]) }}"
when: es_plugins_reinstall and installed_plugins.stdout_lines | length > 0 and not 'No plugin detected' in installed_plugins.stdout_lines[0]
notify: restart elasticsearch
register: plugin_installed
register: plugin_removed
environment:
CONF_DIR: "{{ conf_dir }}"
ES_INCLUDE: "{{ instance_default_file }}"
- name: Install elasticsearch plugins
#debug: var=item
command: >
{{es_home}}/bin/plugin install {{ item.plugin }}{% if item.version is defined and item.version != '' %}/{{ item.version }}{% endif %} {% if item.proxy_host is defined and item.proxy_host != '' and item.proxy_port is defined and item.proxy_port != ''%} -DproxyHost={{ item.proxy_host }} -DproxyPort={{ item.proxy_port }} {% elif es_proxy_host is defined and es_proxy_host != '' %} -DproxyHost={{ es_proxy_host }} -DproxyPort={{ es_proxy_port }} {% endif %} --silent
{{es_home}}/bin/{{ es_binary_prefix }}plugin install {{ item.plugin }}{% if item.version is defined and item.version != '' %}/{{ item.version }}{% endif %} {% if item.proxy_host is defined and item.proxy_host != '' and item.proxy_port is defined and item.proxy_port != ''%} -DproxyHost={{ item.proxy_host }} -DproxyPort={{ item.proxy_port }} {% elif es_proxy_host is defined and es_proxy_host != '' %} -DproxyHost={{ es_proxy_host }} -DproxyPort={{ es_proxy_port }} {% endif %} --silent
register: plugin_installed
failed_when: "'ERROR' in plugin_installed.stdout"
changed_when: plugin_installed.rc == 0

View file

@ -1,5 +1,10 @@
---
- set_fact: es_binary_prefix=""
- set_fact: es_binary_prefix="elasticsearch-"
when: es_version | version_compare('5.0', '>=')
- name: Include optional user and group creation.
when: (es_user_id is defined) and (es_group_id is defined)
include: elasticsearch-optional-user.yml

View file

@ -1,7 +1,7 @@
---
#Test if feature is installed
- shell: "{{es_home}}/bin/plugin list | sed -n '1!p' | grep {{item}}"
- shell: "{{es_home}}/bin/{{ es_binary_prefix }}plugin list{% if es_version | version_compare('5.0', '<') %} | sed -n '1!p' | cut -d '-' -f2-{% endif %} | grep {{item}}"
register: feature_installed
changed_when: False
failed_when: "'ERROR' in feature_installed.stdout"
@ -13,8 +13,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 {{item}}
command: {{es_home}}/bin/plugin remove {{item}}
register: xpack_state
failed_when: "'ERROR' in xpack_state.stdout"
changed_when: xpack_state.rc == 0
@ -28,7 +27,7 @@
#Install plugin if not installed, or the es version has changed (so removed above), and its been requested
- name: Install {{item}} plugin
command: >
{{es_home}}/bin/plugin install {{item}}
{{es_home}}/bin/{{ es_binary_prefix }}plugin install {{item}}
register: xpack_state
failed_when: "'ERROR' in xpack_state.stdout"
changed_when: xpack_state.rc == 0
@ -36,4 +35,4 @@
notify: restart elasticsearch
environment:
CONF_DIR: "{{ conf_dir }}"
ES_INCLUDE: "{{ instance_default_file }}"
ES_INCLUDE: "{{ instance_default_file }}"

View file

@ -7,7 +7,7 @@
#Check if license is installed
- name: Check License plugin is installed
shell: >
{{es_home}}/bin/plugin list | tail -n +2 | grep license
{{es_home}}/bin/{{ es_binary_prefix }}plugin list | tail -n +2 | grep license
register: license_installed
ignore_errors: yes
failed_when: "'ERROR' in license_installed.stdout"
@ -19,7 +19,7 @@
#Remove license if installed and xpack not enabled
- name: Remove license plugin
command: >
{{es_home}}/bin/plugin remove license
{{es_home}}/bin/{{ es_binary_prefix }}plugin remove license
register: xpack_state
failed_when: "'ERROR' in xpack_state.stdout"
changed_when: xpack_state.rc == 0
@ -32,7 +32,7 @@
#Install License if not installed, or it needs to be reinstalled due to ES change (above task will have removed), and its been requested.
- name: Install license plugin
command: >
{{es_home}}/bin/plugin install license
{{es_home}}/bin/{{ es_binary_prefix }}plugin install license
register: xpack_state
failed_when: "'ERROR' in xpack_state.stdout"
changed_when: xpack_state.rc == 0
@ -51,4 +51,4 @@
#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
file: state=directory path={{ es_home }}/plugins owner={{ es_user }} group={{ es_group }} recurse=yes