blob: 361d9fcf20be4131de95eca3c33c36466c2af440 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
---
- name: Disable shard allocation
become: true
vars:
opensearch_shard_body: {"transient": {"cluster.routing.allocation.enable": "none"}}
kolla_toolbox:
container_engine: "{{ kolla_container_engine }}"
module_name: uri
module_args:
url: "{{ opensearch_internal_endpoint }}/_cluster/settings"
method: PUT
status_code: 200
return_content: true
body: "{{ opensearch_shard_body | to_json }}" # noqa jinja[invalid]
body_format: json
ca_path: "{{ openstack_cacert }}"
delegate_to: "{{ groups['opensearch'][0] }}"
run_once: true
listen: "Restart opensearch container"
when:
- kolla_action == "upgrade"
- name: Perform a flush
become: true
kolla_toolbox:
container_engine: "{{ kolla_container_engine }}"
module_name: uri
module_args:
url: "{{ opensearch_internal_endpoint }}/_flush"
method: POST
status_code: 200
return_content: true
body_format: json
ca_path: "{{ openstack_cacert }}"
delegate_to: "{{ groups['opensearch'][0] }}"
run_once: true
retries: 10
delay: 5
register: result
until: ('status' in result) and result.status == 200
listen: "Restart opensearch container"
when:
- kolla_action == "upgrade"
- name: Restart opensearch container
vars:
service_name: "opensearch"
service: "{{ opensearch_services[service_name] }}"
become: true
kolla_container:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
environment: "{{ service.environment }}"
volumes: "{{ service.volumes }}"
dimensions: "{{ service.dimensions }}"
healthcheck: "{{ service.healthcheck | default(omit) }}"
- name: Wait for OpenSearch cluster to recover
become: true
kolla_toolbox:
container_engine: "{{ kolla_container_engine }}"
module_name: uri
module_args:
url: "{{ opensearch_internal_endpoint }}/_cluster/health?wait_for_status=yellow&timeout=30s"
timeout: 35
status_code: 200
validate_certs: "{{ kolla_enable_tls_internal | bool }}"
return_content: true
body_format: json
ca_path: "{{ openstack_cacert }}"
delegate_to: "{{ groups['opensearch'][0] }}"
run_once: true
retries: 60
delay: 5
register: result
until: result.get('status') == 200
listen: "Restart opensearch container"
when:
- kolla_action != "config"
- name: Restart opensearch-dashboards container
vars:
service_name: "opensearch-dashboards"
service: "{{ opensearch_services[service_name] }}"
become: true
kolla_container:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
dimensions: "{{ service.dimensions }}"
environment: "{{ service.environment | default(omit) }}"
image: "{{ service.image }}"
name: "{{ service.container_name }}"
volumes: "{{ service.volumes }}"
healthcheck: "{{ service.healthcheck | default(omit) }}"
|