kolla-ansible/ansible/roles/elasticsearch/tasks/upgrade.yml
Serhat Demircan adb02958e7 Retry perform a synced flush task while upgrading elasticsearch
The synced flush fails due to concurrent indexing operations.
The HTTP status code in that case will be 409 CONFLICT. We can
retry this task until returns success.

Change-Id: I57f9a009b12715eed8dfcf829a71f418d2ce437b
2019-03-27 18:14:07 +03:00

49 lines
1.5 KiB
YAML

---
# 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
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.yml
- name: Flush handlers
meta: flush_handlers