kolla-ansible/ansible/roles/elasticsearch/tasks/upgrade.yml
Mark Goddard a87780cb96 Use FQDN for elasticsearch
This was addressed in I21689e22870c2f6206e37c60a3c33e19140f77ff but
accidentally reverted in I4f74bfe07d4b7ca18953b11e767cf0bb94dfd67e.

Change-Id: Id5fc458b0ca54bddfe9a43cb315dbcfeb2142395
2020-05-05 16:31:26 +00:00

63 lines
1.8 KiB
YAML

---
- name: Set fact for Elasticsearch URL
set_fact:
elasticsearch_url: "{{ internal_protocol }}://{{ kolla_internal_fqdn | put_address_in_context('url') }}:{{ elasticsearch_port }}"
# The official procedure for upgrade elasticsearch:
# https://www.elastic.co/guide/en/elasticsearch/reference/6.x/restart-upgrade.html
- name: Disable shard allocation
become: true
vars:
elasticsearch_shard_body: {"transient": {"cluster.routing.allocation.enable": "none"}}
kolla_toolbox:
module_name: uri
module_args:
url: "{{ elasticsearch_url }}/_cluster/settings"
method: PUT
status_code: 200
return_content: yes
body: "{{ elasticsearch_shard_body | to_json }}"
body_format: json
delegate_to: "{{ groups['elasticsearch'][0] }}"
run_once: true
- name: Perform a synced flush
become: true
kolla_toolbox:
module_name: uri
module_args:
url: "{{ elasticsearch_url }}/_flush/synced"
method: POST
status_code: 200
return_content: yes
body_format: json
delegate_to: "{{ groups['elasticsearch'][0] }}"
run_once: true
retries: 10
delay: 5
register: result
until: ('status' in result) and result.status == 200
# 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-host.yml
- include_tasks: config.yml
- name: Flush handlers
meta: flush_handlers