Ivan Halomi 4ca2d41762 Adding container_engine to kolla_toolbox module
Second part of patchset:
https://review.opendev.org/c/openstack/kolla-ansible/+/799229/
in which was suggested to split patch into smaller ones.

THis change adds container_engine to module parameters
so when we introduce podman, kolla_toolbox can be used
for both engines.

Signed-off-by: Ivan Halomi <i.halomi@partner.samsung.com>
Co-authored-by: Martin Hiner <m.hiner@partner.samsung.com>
Change-Id: Ic2093aa9341a0cb36df8f340cf290d62437504ad
2022-11-04 15:32:30 +01:00

66 lines
1.9 KiB
YAML

---
# 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:
container_engine: "{{ kolla_container_engine }}"
module_name: uri
module_args:
url: "{{ elasticsearch_internal_endpoint }}/_cluster/settings"
method: PUT
status_code: 200
return_content: yes
body: "{{ elasticsearch_shard_body | to_json }}" # noqa jinja[invalid]
body_format: json
delegate_to: "{{ groups['elasticsearch'][0] }}"
run_once: true
- name: Perform a synced flush
become: true
kolla_toolbox:
container_engine: "{{ kolla_container_engine }}"
module_name: uri
module_args:
url: "{{ elasticsearch_internal_endpoint }}/_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]
- import_tasks: config-host.yml
- import_tasks: config.yml
- import_tasks: check-containers.yml
- include_tasks: register.yml
when: elasticsearch_enable_keystone_registration | bool
- name: Flush handlers
meta: flush_handlers