Skip to content

Commit d83d38f

Browse files
Avoid risky pipes. Increase retires to handle clusters with single frozen or cold datanode
1 parent 30e182c commit d83d38f

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

roles/elasticsearch/tasks/elasticsearch-rolling-start.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,15 @@
3636
port: "{{ elasticstack_elasticsearch_http_port }}"
3737
delay: 30
3838

39-
- name: Confirm the node joins the cluster # noqa: risky-shell-pipe
40-
ansible.builtin.shell: >
41-
if test -n "$(ps -p $$ | grep bash)"; then set -o pipefail; fi;
42-
curl
43-
-k
44-
-u elastic:{{ elasticstack_password.stdout }}
45-
-s
46-
-m 2
47-
'{{ elasticsearch_http_protocol }}://{{ elasticsearch_api_host }}:{{ elasticstack_elasticsearch_http_port }}/_cat/nodes?h=name'
48-
| grep
49-
-E
50-
'^{{ elasticsearch_nodename }}$'
51-
register: result
52-
until: result.rc == 0
39+
- name: Confirm the node joins the cluster
40+
ansible.builtin.uri:
41+
url: "{{ elasticsearch_http_protocol }}://{{ elasticsearch_api_host }}:{{ elasticstack_elasticsearch_http_port }}//_cat/nodes?h=name&format=json"
42+
method: GET
43+
user: elastic
44+
password: "{{ elasticstack_password.stdout }}"
45+
validate_certs: no
46+
register: response
47+
until: response.json | json_query("[?name=='{{ elasticsearch_nodename }}']") | length > 0
5348
retries: 200
5449
delay: 3
5550
changed_when: false
@@ -79,5 +74,5 @@
7974
validate_certs: no
8075
register: response
8176
until: "response.json.status == 'yellow' or response.json.status == 'green'"
82-
retries: 5
77+
retries: 200
8378
delay: 30

0 commit comments

Comments
 (0)