Skip to content

Commit a77010d

Browse files
committed
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 a77010d

7 files changed

Lines changed: 34 additions & 28 deletions

File tree

ansible.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
timeout = 20
33

44
[ssh_connection]
5-
pipelining = True
65
ssh_args = -C -o ControlMaster=auto -o ControlPersist=86400s

ansible/playbooks/roles/sap_hana_install/tasks/post_install/hdbuserstore.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22

33
- name: SAP HANA Post Install - Create and Store Connection Info in hdbuserstore
4+
vars:
5+
ansible_pipelining: true
46
ansible.builtin.shell: |
57
/usr/sap/{{ sap_hana_install_sid }}/SYS/exe/hdb/hdbuserstore \
68
SET {{ sap_hana_install_hdbuserstore_key }} \

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

scripts/qesap/lib/cmds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def ansible_command_sequence(
313313
# 1. Create the environment variable set
314314
# that will be used by any command
315315
original_env = dict(os.environ)
316-
original_env["ANSIBLE_PIPELINING"] = "True"
316+
original_env["ANSIBLE_PIPELINING"] = "False"
317317
original_env["ANSIBLE_TIMEOUT"] = "20"
318318
ansible_callbacks = []
319319
if profile:

scripts/qesap/test/conftest.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,6 @@ def _callback(inventory):
230230
def mock_call_ansibleplaybook():
231231
"""
232232
create a mock.call with some default elements
233-
```
234-
mock.call('ansible-playbook -i inventory, playbook', env={'ANSIBLE_PIPELINING', 'True'})
235-
```
236233
"""
237234

238235
def _callback(inventory, playbook, verbosity="-vv", arguments=None, env=None):
@@ -241,7 +238,7 @@ def _callback(inventory, playbook, verbosity="-vv", arguments=None, env=None):
241238
playbook_cmd += arguments
242239
if env is None:
243240
original_env = dict(os.environ)
244-
original_env["ANSIBLE_PIPELINING"] = "True"
241+
original_env["ANSIBLE_PIPELINING"] = "False"
245242
original_env["ANSIBLE_TIMEOUT"] = "20"
246243
else:
247244
original_env = env

scripts/qesap/test/unit/test_qesap_ansible.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ def test_ansible_env_config(
625625
# Keep it here just to be more explicit and due to the fact that here
626626
# the os.environ is mock.
627627
expected_env = {"MELAMPO": "cane"}
628-
expected_env["ANSIBLE_PIPELINING"] = "True"
628+
expected_env["ANSIBLE_PIPELINING"] = "False"
629629
expected_env["ANSIBLE_TIMEOUT"] = "20"
630630
for playbook in playbook_files_list:
631631
calls.append(mock_call_ansibleplaybook(inventory, playbook, env=expected_env))
@@ -671,8 +671,12 @@ def test_ansible_profile(
671671
playbook_files_list = create_playbooks(playbooks["create"])
672672
calls = []
673673
expected_env = {"MELAMPO": "cane"}
674+
<<<<<<< HEAD
674675
expected_env["ANSIBLE_PIPELINING"] = "True"
675676
expected_env["ANSIBLE_TIMEOUT"] = "20"
677+
=======
678+
expected_env["ANSIBLE_PIPELINING"] = "False"
679+
>>>>>>> 94e5754 (Remove pipelining from ansible.cfg)
676680
expected_env["ANSIBLE_CALLBACKS_ENABLED"] = "ansible.posix.profile_tasks"
677681
for playbook in playbook_files_list:
678682
calls.append(mock_call_ansibleplaybook(inventory, playbook, env=expected_env))
@@ -721,8 +725,12 @@ def test_ansible_junit(
721725
playbook_files_list = create_playbooks(playbooks["create"])
722726
calls = []
723727
expected_env = {"MELAMPO": "cane"}
728+
<<<<<<< HEAD
724729
expected_env["ANSIBLE_PIPELINING"] = "True"
725730
expected_env["ANSIBLE_TIMEOUT"] = "20"
731+
=======
732+
expected_env["ANSIBLE_PIPELINING"] = "False"
733+
>>>>>>> 94e5754 (Remove pipelining from ansible.cfg)
726734
expected_env["ANSIBLE_CALLBACKS_ENABLED"] = "junit"
727735
expected_env["JUNIT_OUTPUT_DIR"] = "/something/somewhere"
728736
for playbook in playbook_files_list:
@@ -777,8 +785,12 @@ def test_ansible_env_roles_path(
777785
playbook_files_list = create_playbooks(["get_cherry_wood"])
778786
calls = []
779787
expected_env = dict(os.environ)
788+
<<<<<<< HEAD
780789
expected_env["ANSIBLE_PIPELINING"] = "True"
781790
expected_env["ANSIBLE_TIMEOUT"] = "20"
791+
=======
792+
expected_env["ANSIBLE_PIPELINING"] = "False"
793+
>>>>>>> 94e5754 (Remove pipelining from ansible.cfg)
782794
expected_env["ANSIBLE_ROLES_PATH"] = "somewhere"
783795
for playbook in playbook_files_list:
784796
calls.append(mock_call_ansibleplaybook(inventory, playbook, env=expected_env))

0 commit comments

Comments
 (0)