From c408afbae7133b02ab1c5c918e44cb746af7c330 Mon Sep 17 00:00:00 2001 From: Kevin Tibi Date: Thu, 5 Jul 2018 12:15:25 +0200 Subject: [PATCH] Update elasticsearch and kibana version to 5.x Change the path for kibana binary and add upgrade tasks for elasticsearch [1]. [1] https://www.elastic.co/guide/en/elasticsearch/reference/5.0/restart-upgrade.html Depends-On: I8ed60eab2c15ae966960bcbeadb7aa25fece83a5 Change-Id: I9f566c0cb808c905736cc4090539672863260ad5 Implements: bp-elasticsearch-upgrade --- ansible/roles/elasticsearch/tasks/upgrade.yml | 39 +++++++++++++++++++ ansible/roles/kibana/templates/kibana.json.j2 | 4 +- ansible/roles/kibana/templates/kibana.yml.j2 | 13 +------ 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/ansible/roles/elasticsearch/tasks/upgrade.yml b/ansible/roles/elasticsearch/tasks/upgrade.yml index 375dcad19b..6dcca60db0 100644 --- a/ansible/roles/elasticsearch/tasks/upgrade.yml +++ b/ansible/roles/elasticsearch/tasks/upgrade.yml @@ -1,4 +1,43 @@ --- +# The official procedure for upgrade elasticsearch: +# https://www.elastic.co/guide/en/elasticsearch/reference/5.6/restart-upgrade.html +- name: Disable shard allocation + uri: + url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ elasticsearch_port }}/_cluster/settings" + method: PUT + status_code: 200 + return_content: yes + body: {"transient":{"cluster.routing.allocation.enable": "none"}} + body_format: json + delegate_to: "{{ groups['elasticsearch'][0] }}" + run_once: true + +- name: Perform a synced flush + uri: + url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ elasticsearch_port }}/_flush/synced" + method: POST + status_code: 200 + return_content: yes + body_format: json + delegate_to: "{{ groups['elasticsearch'][0] }}" + run_once: true + +# Stop all elasticsearch containers before applying configuration to ensure +# handlers are triggered to restart them. +- name: Stopping all elasticsearch containers + vars: + service_name: "elasticsearch" + service: "{{ elasticsearch_services[service_name] }}" + become: true + kolla_docker: + action: "stop_container" + common_options: "{{ docker_common_options }}" + name: "elasticsearch" + image: "{{ service.image }}" + environment: "{{ service.environment }}" + volumes: "{{ service.volumes }}" + when: inventory_hostname in groups[service.group] + - include_tasks: config.yml - name: Flush handlers diff --git a/ansible/roles/kibana/templates/kibana.json.j2 b/ansible/roles/kibana/templates/kibana.json.j2 index 599c107af1..f2dfaa9573 100644 --- a/ansible/roles/kibana/templates/kibana.json.j2 +++ b/ansible/roles/kibana/templates/kibana.json.j2 @@ -1,9 +1,9 @@ { - "command": "/opt/kibana/bin/kibana", + "command": "/usr/share/kibana/bin/kibana", "config_files": [ { "source": "{{ container_config_directory }}/kibana.yml", - "dest": "/opt/kibana/config/kibana.yml", + "dest": "/etc/kibana/kibana.yml", "owner": "kibana", "perm": "0640" } diff --git a/ansible/roles/kibana/templates/kibana.yml.j2 b/ansible/roles/kibana/templates/kibana.yml.j2 index b652a51c6b..ecd33f2d4a 100644 --- a/ansible/roles/kibana/templates/kibana.yml.j2 +++ b/ansible/roles/kibana/templates/kibana.yml.j2 @@ -5,15 +5,4 @@ server.host: "{{ api_interface_address }}" elasticsearch.url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ elasticsearch_port }}" elasticsearch.requestTimeout: {{ kibana_elasticsearch_request_timeout }} elasticsearch.shardTimeout: {{ kibana_elasticsearch_shard_timeout }} -elasticsearch.ssl.verify: {{ kibana_elasticsearch_ssl_verify }} -bundled_plugin_ids: - - plugins/dashboard/index - - plugins/discover/index - - plugins/doc/index - - plugins/kibana/index - - plugins/markdown_vis/index - - plugins/metric_vis/index - - plugins/settings/index - - plugins/table_vis/index - - plugins/vis_types/index - - plugins/visualize/index +elasticsearch.ssl.verificationMode: "{{ 'full' if kibana_elasticsearch_ssl_verify | bool else 'none' }}"