Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
igorribeiroduarte committed Apr 17, 2024
1 parent 55b0d59 commit da57435
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions ansible-scylla-node/tasks/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit da57435

Please sign in to comment.