Fix for detecting es version changed

This commit is contained in:
Dale McDiarmid 2016-07-24 17:39:44 +01:00
parent 0a269a3d82
commit 9eacd3a5e0
5 changed files with 20 additions and 6 deletions

View file

@ -11,8 +11,9 @@
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('|')}}'{% endif %}"
- 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 %}"
register: installed_plugins
failed_when: "'ERROR' in installed_plugins.stdout"
changed_when: False
ignore_errors: yes
environment:

View file

@ -1,7 +1,5 @@
---
- set_fact: es_version_changed=((elasticsearch_install_from_package is defined and elasticsearch_install_from_repo.changed) or (elasticsearch_install_from_package is defined and elasticsearch_install_from_package.changed))
#Test if feature is installed
- shell: "{{es_home}}/bin/plugin list | sed -n '1!p' | grep {{item}}"
register: feature_installed

View file

@ -1,8 +1,10 @@
---
- set_fact: es_version_changed=((elasticsearch_install_from_package is defined and elasticsearch_install_from_repo.changed) or (elasticsearch_install_from_package is defined and elasticsearch_install_from_package.changed))
- set_fact: es_version_changed={{((elasticsearch_install_from_package is defined and elasticsearch_install_from_repo.changed) or (elasticsearch_install_from_package is defined and elasticsearch_install_from_package.changed))}}
#enabling xpack installs the license. Not a xpack feature and does not need to be specified
- debug: msg="{{es_version_changed}}"
#enabling xpack installs the license. Not a xpack feature and does not need to be specified - TODO: we should append it to the list if xpack is enabled and remove this
#Check if license is installed
- name: Check License is installed
@ -10,6 +12,7 @@
{{es_home}}/bin/plugin list | tail -n +2 | grep license
register: license_installed
ignore_errors: yes
failed_when: "'ERROR' in license_installed.stdout"
changed_when: False
environment:
CONF_DIR: "{{ conf_dir }}"
@ -41,7 +44,7 @@
CONF_DIR: "{{ conf_dir }}"
ES_INCLUDE: "{{ instance_default_file }}"
#We loop on all as we may need to remove some features
#We loop on all as we may need to remove some features.
- include: elasticsearch-xpack-install.yml
with_items: "{{supported_xpack_features}}"

View file

@ -111,6 +111,15 @@ shared_examples 'xpack::init' do |es_version|
its(:exit_status) { should eq 0 }
end
describe file('/usr/share/elasticsearch/plugins/kopf') do
it { should be_directory }
it { should be_owned_by 'elasticsearch' }
end
describe command('curl -s localhost:9200/_nodes/plugins?pretty=true -u es_admin:changeMe | grep kopf') do
its(:exit_status) { should eq 0 }
end
#test we haven't installed graph or marvel-agent
describe file('/usr/share/elasticsearch/plugins/graph') do

View file

@ -8,6 +8,9 @@
vars:
es_templates: true
es_enable_xpack: true
es_plugins:
- plugin: lmenezes/elasticsearch-kopf
version: master
es_xpack_features:
- shield
- watcher