Skip to content

Commit 431697b

Browse files
authored
Merge pull request #1078 from berndfinger/issue-1077-add-condition-to-asserts-of-ibm-power-tools
sap_*_preconfigure: Assert the presence of the IBM tools only if necessary
2 parents 1218ace + 555d167 commit 431697b

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

roles/sap_general_preconfigure/tasks/RedHat/assert-installation.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@
168168
awk '/Name/{n=$NF}/Version/{v=$NF}/Release/{r=$NF}/Description/{printf ("%s\n", n)}'
169169
register: __sap_general_preconfigure_register_required_ppc64le_packages_assert
170170
changed_when: false
171-
when: ansible_architecture == "ppc64le"
171+
when:
172+
- ansible_architecture == "ppc64le"
173+
- sap_general_preconfigure_install_ibm_power_tools
172174
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
173175

174176
- name: Assert that all required IBM packages are installed
@@ -180,7 +182,9 @@
180182
- "{{ __sap_general_preconfigure_required_ppc64le }}"
181183
loop_control:
182184
loop_var: line_item
183-
when: ansible_architecture == "ppc64le"
185+
when:
186+
- ansible_architecture == "ppc64le"
187+
- sap_general_preconfigure_install_ibm_power_tools
184188
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
185189

186190
- name: Minimum required package version check

roles/sap_hana_preconfigure/tasks/RedHat/assert-installation.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,16 @@
8989
### # /opt/ibm/lop/configure
9090
### # yum -y install ibm-power-managed-rhel7
9191
###
92-
# Reasons for noqa:
93-
# command-instead-of-module: I need to examine the output of the yum info command.
94-
# risky-shell-pipe: If a package is not installed, the shell command will fail. But I want the command to
95-
# succeed so that the awk command can examine the result.
96-
- name: Get install status of required IBM packages # noqa command-instead-of-module risky-shell-pipe
92+
- name: Get install status of required IBM packages
9793
ansible.builtin.shell: |
98-
yum info installed {{ __sap_hana_preconfigure_required_ppc64le | map('quote') | join(' ') }} |
94+
set -o pipefail && yum info installed {{ __sap_hana_preconfigure_required_ppc64le | map('quote') | join(' ') }} |
9995
awk '/Name/{n=$NF}/Version/{v=$NF}/Release/{r=$NF}/Description/{printf ("%s\n", n)}'
10096
register: __sap_hana_preconfigure_register_required_ppc64le_packages_assert
101-
changed_when: no
102-
when: ansible_architecture == "ppc64le"
97+
changed_when: false
98+
when:
99+
- ansible_architecture == "ppc64le"
100+
- sap_general_preconfigure_install_ibm_power_tools
101+
ignore_errors: "{{ sap_hana_preconfigure_assert_ignore_errors | d(false) }}"
103102

104103
- name: Assert that all required IBM packages are installed
105104
ansible.builtin.assert:
@@ -110,7 +109,9 @@
110109
- "{{ __sap_hana_preconfigure_required_ppc64le }}"
111110
loop_control:
112111
loop_var: line_item
113-
when: ansible_architecture == "ppc64le"
112+
when:
113+
- ansible_architecture == "ppc64le"
114+
- sap_general_preconfigure_install_ibm_power_tools
114115
ignore_errors: "{{ sap_hana_preconfigure_assert_ignore_errors | d(false) }}"
115116

116117
- name: Minimum required package version check

0 commit comments

Comments
 (0)