From 1ec685d0ef1cd3affc6de5c1a5d880e5203c555e Mon Sep 17 00:00:00 2001 From: unkls Date: Wed, 3 Apr 2024 15:36:24 +0200 Subject: [PATCH 1/4] common - update builtin + fix empty when condition --- ansible-scylla-node/tasks/common.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ansible-scylla-node/tasks/common.yml b/ansible-scylla-node/tasks/common.yml index 28ccf857..dad8d35c 100644 --- a/ansible-scylla-node/tasks/common.yml +++ b/ansible-scylla-node/tasks/common.yml @@ -304,18 +304,19 @@ # Therefore in order to be able to get the corresponding value via hostvars[item] later in the play we need to # have an actual value resolved. # One way to do that is to resolve it and store as an Ansible fact. + - name: Resolve a scylla_listen_address as a fact - set_fact: + ansible.builtin.set_fact: listen_address: "{{ scylla_listen_address }}" # The same relates to the below - name: Resolve scylla_rpc_address - set_fact: + ansible.builtin.set_fact: rpc_address: "{{ scylla_rpc_address }}" # The same relates to the below - name: Resolve scylla_broadcast_address - set_fact: + ansible.builtin.set_fact: broadcast_address: "{{ scylla_broadcast_address }}" - name: start_scylla_service dependent tasks @@ -329,13 +330,14 @@ run_once: true include_tasks: start_one_node.yml loop: "{{ groups['scylla'] }}" - when: hostvars[item]['broadcast_address'] in scylla_seeds or item in scylla_seeds + when: (hostvars[item]['broadcast_address'] is defined) and ((hostvars[item]['broadcast_address'] in scylla_seeds) or (item in scylla_seeds)) - name: Start scylla non-seeds nodes serially run_once: true include_tasks: start_one_node.yml loop: "{{ groups['scylla'] }}" when: + - hostvars[item]['broadcast_address'] is defined - item not in scylla_seeds - hostvars[item]['broadcast_address'] not in scylla_seeds From 860101ee6820d8ed64f04ff6e18a51c5ac81a8ac Mon Sep 17 00:00:00 2001 From: unkls Date: Fri, 5 Apr 2024 14:17:01 +0200 Subject: [PATCH 2/4] ansible-scylla-node: support running the role on limited number of nodes, skip tasks that miss information --- ansible-scylla-node/tasks/common.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ansible-scylla-node/tasks/common.yml b/ansible-scylla-node/tasks/common.yml index 28ccf857..af081acf 100644 --- a/ansible-scylla-node/tasks/common.yml +++ b/ansible-scylla-node/tasks/common.yml @@ -329,13 +329,14 @@ run_once: true include_tasks: start_one_node.yml loop: "{{ groups['scylla'] }}" - when: hostvars[item]['broadcast_address'] in scylla_seeds or item in scylla_seeds + when: (hostvars[item]['broadcast_address'] is defined) and ((hostvars[item]['broadcast_address'] in scylla_seeds) or (item in scylla_seeds)) - name: Start scylla non-seeds nodes serially run_once: true include_tasks: start_one_node.yml loop: "{{ groups['scylla'] }}" when: + - hostvars[item]['broadcast_address'] is defined - item not in scylla_seeds - hostvars[item]['broadcast_address'] not in scylla_seeds From 8cf774ac13c817e9e96595cf8ef0fd4a0bfe5e8f Mon Sep 17 00:00:00 2001 From: unkls Date: Fri, 5 Apr 2024 14:20:35 +0200 Subject: [PATCH 3/4] ansible-scylla-node: Update set_fact to use builtin modules from ansible 2.10 --- ansible-scylla-node/tasks/common.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ansible-scylla-node/tasks/common.yml b/ansible-scylla-node/tasks/common.yml index af081acf..b9c2f7fa 100644 --- a/ansible-scylla-node/tasks/common.yml +++ b/ansible-scylla-node/tasks/common.yml @@ -305,17 +305,17 @@ # have an actual value resolved. # One way to do that is to resolve it and store as an Ansible fact. - name: Resolve a scylla_listen_address as a fact - set_fact: + ansible.builtin.set_fact: listen_address: "{{ scylla_listen_address }}" # The same relates to the below - name: Resolve scylla_rpc_address - set_fact: + ansible.builtin.set_fact: rpc_address: "{{ scylla_rpc_address }}" # The same relates to the below - name: Resolve scylla_broadcast_address - set_fact: + ansible.builtin.set_fact: broadcast_address: "{{ scylla_broadcast_address }}" - name: start_scylla_service dependent tasks From 6e7fefb0cff129e371d22fc1511756e4eb527df7 Mon Sep 17 00:00:00 2001 From: unkls Date: Fri, 5 Apr 2024 14:26:39 +0200 Subject: [PATCH 4/4] ansible-scylla-node: Remove the added line to adhere to the current commentary sections --- ansible-scylla-node/tasks/common.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/ansible-scylla-node/tasks/common.yml b/ansible-scylla-node/tasks/common.yml index dad8d35c..b9c2f7fa 100644 --- a/ansible-scylla-node/tasks/common.yml +++ b/ansible-scylla-node/tasks/common.yml @@ -304,7 +304,6 @@ # Therefore in order to be able to get the corresponding value via hostvars[item] later in the play we need to # have an actual value resolved. # One way to do that is to resolve it and store as an Ansible fact. - - name: Resolve a scylla_listen_address as a fact ansible.builtin.set_fact: listen_address: "{{ scylla_listen_address }}"