diff --git a/ansible-scylla-node/tasks/common.yml b/ansible-scylla-node/tasks/common.yml index 5d61a8fa..4d75662d 100644 --- a/ansible-scylla-node/tasks/common.yml +++ b/ansible-scylla-node/tasks/common.yml @@ -345,9 +345,15 @@ host: "{{ scylla_api_address }}" timeout: 300 + - name: Create a list with the broadcast addresses of the nodes in play_hosts + set_fact: + broadcast_address_list: "{{ broadcast_address_list | default([]) + [hostvars[item]['broadcast_address']] }}" + loop: "{{ play_hosts }}" + run_once: true + - name: wait for the cluster to become healthy shell: | - nodetool status|grep -E '^UN|^UJ|^DN'| grep -Ew "{{ play_hosts | join('|') }}" | wc -l + nodetool status|grep -E '^UN|^UJ|^DN'| grep -Ew "{{ broadcast_address_list | join('|') }}" | wc -l register: node_count until: node_count.stdout|int == play_hosts|length retries: "{{ scylla_bootstrap_wait_time_sec|int }}" @@ -392,26 +398,15 @@ - name: Check if all nodes are up block: - - name: Use Scylla API to see if the nodes are up - uri: - url: "http://{{ scylla_api_address }}:{{ scylla_api_port }}/failure_detector/endpoints/" - follow_redirects: none - method: GET - register: _failure_detector_result - until: _failure_detector_result.status == 200 - retries: 3 - delay: 1 - ignore_errors: true - delegate_to: "{{ item }}" - loop: "{{ groups['scylla'] }}" - run_once: true + - name: Check if there are joining or down nodes + shell: | + nodetool status|grep -E '^UJ|^DN' | wc -l + register: node_count - name: Set all_nodes_up as a fact set_fact: - all_nodes_up: "{% if item.status is defined and item.status == 200 %}{{ True }}{% else %}{{ False }}{% endif %}" - when: all_nodes_up is not defined or all_nodes_up|bool - loop: "{{ _failure_detector_result.results }}" - run_once: true + all_nodes_up: "{{ node_count.stdout|int == 0 }}" + run_once: true - name: Adjust replication for system_auth keyspace include_tasks: adjust_keyspace_replication.yml