Skip to content

Commit c5a3391

Browse files
committed
Avoid unsafe conditional error
1 parent fd21463 commit c5a3391

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,19 @@
3838

3939
- name: Confirm the node joins the cluster
4040
ansible.builtin.uri:
41-
url: "{{ elasticsearch_http_protocol }}://{{ elasticsearch_api_host }}:{{ elasticstack_elasticsearch_http_port }}//_cat/nodes?h=name&format=json"
41+
url: "{{ elasticsearch_http_protocol }}://{{ elasticsearch_api_host }}:{{ elasticstack_elasticsearch_http_port }}/_cat/nodes?h=name&format=json"
4242
method: GET
4343
user: elastic
4444
password: "{{ elasticstack_password.stdout }}"
4545
validate_certs: no
4646
register: response
47-
until: response.json | json_query("[?name=='{{ elasticsearch_nodename }}']") | length > 0
47+
until: node_found | bool
4848
retries: 200
4949
delay: 3
5050
changed_when: false
51+
vars:
52+
node_found: "{{ response.json | json_query(node_query) | length > 0 }}"
53+
node_query: "[?name=='{{ elasticsearch_nodename }}']"
5154

5255
- name: Enable shard allocation for the cluster
5356
ansible.builtin.uri:

0 commit comments

Comments
 (0)