Skip to content

Commit 32b0698

Browse files
authored
Change cluster init to use --transport (#414)
Check installed crmsh package version and use legacy `-u` or new `--transport udpu` if version 5.0.0 or newer is used. Decide according to the crmsh installed version.
1 parent c58b8c7 commit 32b0698

2 files changed

Lines changed: 17 additions & 21 deletions

File tree

ansible/playbooks/sap-hana-system-replication-hooks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
- name: SAP Hana system replication hoks
2+
- name: SAP Hana system replication hooks
33
hosts: hana
44
remote_user: cloudadmin
55
become: true

ansible/playbooks/tasks/azure-cluster-bootstrap.yaml

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@
159159
state: link
160160
when: ansible_distribution_major_version == '16'
161161

162+
- name: Gather crmsh package facts
163+
ansible.builtin.package_facts:
164+
manager: auto
165+
166+
- name: Set crmsh transport flag
167+
ansible.builtin.set_fact:
168+
crmsh_transport_flag: "{{ '--transport udpu' if ansible_facts.packages['crmsh'][0].version is version('5.0.0', '>=') else '-u' }}"
169+
162170
- name: Softfail for old cloud-regionsrv-client in 15sp2
163171
ansible.builtin.debug:
164172
msg:
@@ -176,33 +184,21 @@
176184
sbd_paths: "{{ sbd_slurp['content'] | b64decode | regex_findall('SBD_DEVICE=(.+)') | last }}"
177185
when: use_sbd | default(false) | bool
178186

179-
- name: Create the cluster on primary [sbd]
180-
ansible.builtin.command:
181-
cmd: >-
187+
- name: Set crm cluster init command
188+
ansible.builtin.set_fact:
189+
crm_cluster_init_cmd: >-
182190
crm cluster init
183191
-y
184192
-n qe-cluster
185-
-s {{ sbd_paths }}
186-
-w softdog
187193
-i eth0
188-
-u
189-
creates: /etc/corosync/corosync.conf
190-
when:
191-
- is_primary
192-
- use_sbd | default(false) | bool
194+
{{ crmsh_transport_flag }}
195+
{{ '-s ' + sbd_paths + ' -w softdog' if use_sbd | default(false) | bool else '' }}
193196
194-
- name: Create the cluster on primary [azure fencing]
197+
- name: Create the cluster on primary
195198
ansible.builtin.command:
196-
cmd: >-
197-
crm cluster init
198-
-y
199-
-n qe-cluster
200-
-i eth0
201-
-u
199+
cmd: "{{ crm_cluster_init_cmd }}"
202200
creates: /etc/corosync/corosync.conf
203-
when:
204-
- is_primary
205-
- not (use_sbd | default(false) | bool)
201+
when: is_primary
206202

207203
# check crm status
208204
- name: Check the cluster on primary

0 commit comments

Comments
 (0)