Skip to content

Commit 70d3dd9

Browse files
authored
Merge pull request #994 from marcelmamula/patterns
sap_*_preconfigure/SLES: Enhance saptune handling and detection
2 parents 33f0255 + 2295e51 commit 70d3dd9

33 files changed

+315
-99
lines changed

roles/sap_general_preconfigure/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ If you set the RHEL minor release, then you must also use the `eus` or `e4s` rep
258258
- _Type:_ `str`
259259
- _Default:_ (set by platform/environment specific variables)
260260

261-
The name of the software package group to install.<br>
261+
(RedHat specific) The name of the software package group to install.<br>
262262
The default for this parameter is set in the vars file which corresponds to the detected OS version.<br>
263263

264264
Example:
@@ -271,7 +271,7 @@ Example:
271271
- _Type:_ `str`
272272
- _Default:_ (set by platform/environment specific variables)
273273

274-
The name of the software environment group to check.<br>
274+
(RedHat specific) The name of the software environment group to check.<br>
275275
The default for this parameter is set in the vars file which corresponds to the detected OS version.<br>
276276

277277
Example:
@@ -280,6 +280,13 @@ Example:
280280
'@minimal-environment'
281281
```
282282

283+
### sap_general_preconfigure_patterns
284+
- _Type:_ `list` with elements of type `str`
285+
- _Default:_ (set by platform/environment specific variables)
286+
287+
(SUSE specific) The list of the zypper patterns to install.<br>
288+
The default for this parameter is set in the vars file which corresponds to the detected OS version.<br>
289+
283290
### sap_general_preconfigure_packages
284291
- _Type:_ `list` with elements of type `str`
285292
- _Default:_ (set by platform/environment specific variables)

roles/sap_general_preconfigure/defaults/main.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,19 @@ sap_general_preconfigure_set_minor_release: false
6969
# If you set the RHEL minor release, then you must also use the `eus` or `e4s` repos.
7070

7171
sap_general_preconfigure_packagegroups: "{{ __sap_general_preconfigure_packagegroups }}"
72-
# The name of the software package group to install.
72+
# (RedHat specific) The name of the software package group to install.
7373
# The default for this parameter is set in the vars file which corresponds to the detected OS version.
7474
# Example: See README.md
7575

7676
sap_general_preconfigure_envgroups: "{{ __sap_general_preconfigure_envgroups }}"
77-
# The name of the software environment group to check.
77+
# (RedHat specific) The name of the software environment group to check.
7878
# The default for this parameter is set in the vars file which corresponds to the detected OS version.
7979
# Example: See README.md
8080

81+
sap_general_preconfigure_patterns: "{{ __sap_general_preconfigure_patterns }}"
82+
# (SUSE specific) The list of the zypper patterns to install.
83+
# The default for this parameter is set in the vars file which corresponds to the detected OS version.
84+
8185
sap_general_preconfigure_packages: "{{ __sap_general_preconfigure_packages }}"
8286
# The list of packages to be installed.
8387
# The default for this variable is set in the vars file which corresponds to the detected OS version.

roles/sap_general_preconfigure/meta/argument_specs.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ argument_specs:
152152
sap_general_preconfigure_packagegroups:
153153
default: "{{ __sap_general_preconfigure_packagegroups }}"
154154
description:
155-
- The name of the software package group to install.
155+
- (RedHat specific) The name of the software package group to install.
156156
- The default for this parameter is set in the vars file which corresponds to the detected OS version.
157157
example:
158158
'@minimal-environment'
@@ -162,13 +162,22 @@ argument_specs:
162162
sap_general_preconfigure_envgroups:
163163
default: "{{ __sap_general_preconfigure_envgroups }}"
164164
description:
165-
- The name of the software environment group to check.
165+
- (RedHat specific) The name of the software environment group to check.
166166
- The default for this parameter is set in the vars file which corresponds to the detected OS version.
167167
example:
168168
'@minimal-environment'
169169
required: false
170170
type: str
171171

172+
sap_general_preconfigure_patterns:
173+
default: "{{ __sap_general_preconfigure_patterns }}"
174+
description:
175+
- (SUSE specific) The list of the zypper patterns to install.
176+
- The default for this parameter is set in the vars file which corresponds to the detected OS version.
177+
required: false
178+
type: list
179+
elements: str
180+
172181
sap_general_preconfigure_packages:
173182
default: "{{ __sap_general_preconfigure_packages }}"
174183
description:

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
# SPDX-License-Identifier: Apache-2.0
22
---
33

4+
- name: Query installed zypper patterns
5+
ansible.builtin.command:
6+
cmd: zypper patterns --installed-only
7+
register: __sap_general_preconfigure_register_patterns
8+
changed_when: false
9+
ignore_errors: true
10+
11+
- name: Assert that all required zypper patterns are installed
12+
ansible.builtin.assert:
13+
that: "'{{ item }}' in __sap_general_preconfigure_register_patterns.stdout"
14+
fail_msg: "FAIL: Pattern '{{ item }}' is not installed!"
15+
success_msg: "PASS: Pattern '{{ item }}' is installed."
16+
loop: "{{ sap_general_preconfigure_patterns }}"
17+
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
18+
19+
420
# Both sap_general_preconfigure_packages and __sap_general_preconfigure_min_pkgs are checked at same time.
521
# Check rpm --whatprovides only if package cannot be found directly.
622
- name: Query RPM packages

roles/sap_general_preconfigure/tasks/SLES/generic/saptune_takeover.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,27 +62,29 @@
6262
changed_when: false
6363

6464

65-
- name: Check active saptune solution
65+
- name: Block to show current enabled saptune solution
6666
when:
6767
- __sap_general_preconfigure_use_saptune
6868
- __sap_general_preconfigure_register_saptune_check_before.rc == 0
6969
or (__sap_general_preconfigure_register_saptune_check_after.rc == 0)
7070
block:
71-
- name: Discover active solution
71+
- name: Get current enabled saptune solution
7272
ansible.builtin.command:
7373
cmd: saptune solution enabled
74-
register: __sap_general_preconfigure_register_saptune_status
74+
register: __sap_general_preconfigure_register_saptune_enabled
7575
changed_when: false
76+
failed_when: false
7677

77-
- name: Set fact for active solution
78+
# Enabled solution contains newline, which has to be removed
79+
- name: Cleanup saptune solution enabled output
7880
ansible.builtin.set_fact:
79-
# Capture the first block on none whitespace
80-
__sap_general_preconfigure_register_solution_configured:
81-
"{{ (__sap_general_preconfigure_register_saptune_status.stdout | regex_search('(\\S+)', '\\1'))[0] | default('NONE') }}"
81+
__sap_general_preconfigure_register_saptune_enabled_trim:
82+
"{{ __sap_general_preconfigure_register_saptune_enabled.stdout | trim | replace('\n', '') }}"
8283

83-
- name: Show configured solution
84+
- name: Show current enabled saptune solution
8485
ansible.builtin.debug:
85-
var: __sap_general_preconfigure_register_solution_configured
86+
msg: "{{ __sap_general_preconfigure_register_saptune_enabled_trim }}"
87+
when: __sap_general_preconfigure_register_saptune_enabled_trim != ''
8688

8789

8890
- name: Enable sapconf

roles/sap_general_preconfigure/tasks/SLES/installation.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@
2929
when: "'packagekit.service' in ansible_facts.services"
3030

3131

32+
# Pattern installation will run only if pattern is not installed
33+
# This ensures that command module shows correct changed status
34+
- name: Query installed zypper patterns
35+
ansible.builtin.command:
36+
cmd: zypper patterns --installed-only
37+
register: __sap_general_preconfigure_register_patterns
38+
changed_when: false
39+
ignore_errors: true
40+
41+
- name: Ensure that the required zypper patterns are installed
42+
ansible.builtin.command:
43+
cmd: zypper install -y -t pattern {{ item }}
44+
loop: "{{ sap_general_preconfigure_patterns }}"
45+
when: item not in __sap_general_preconfigure_register_patterns.stdout
46+
changed_when: item not in __sap_general_preconfigure_register_patterns.stdout
47+
3248
- name: Ensure that the required packages are installed
3349
ansible.builtin.package:
3450
state: present

roles/sap_general_preconfigure/vars/SLES_15.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ __sap_general_preconfigure_sapnotes_versions:
99
# 2369910 - SAP Software on Linux: General information
1010
- { number: '2369910', version: '18' }
1111

12+
__sap_general_preconfigure_patterns:
13+
- sap_server
14+
1215
__sap_general_preconfigure_packages:
16+
# Patterns are not included in package list
17+
# Ansible package module skips recommended packages resulting in discrepancies.
18+
1319
- uuidd
1420
- tcsh
1521
- psmisc

roles/sap_general_preconfigure/vars/SLES_SAP_15.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ __sap_general_preconfigure_sapnotes_versions:
99
# 2369910 - SAP Software on Linux: General information
1010
- { number: '2369910', version: '18' }
1111

12+
__sap_general_preconfigure_patterns:
13+
- sap_server
14+
1215
__sap_general_preconfigure_packages:
13-
# Mandatory patterns
14-
- patterns-server-enterprise-sap_server
16+
# Patterns are not included in package list
17+
# Ansible package module skips recommended packages resulting in discrepancies.
1518

1619
# Recommended packages
1720
- tcsh

roles/sap_general_preconfigure/vars/SLES_SAP_16.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55

66
__sap_general_preconfigure_sapnotes_versions: []
77

8+
__sap_general_preconfigure_patterns:
9+
- sles_minimal_sap
10+
811
__sap_general_preconfigure_packages:
9-
# Mandatory patterns
10-
- patterns-sap-base_sap_server
12+
# Patterns are not included in package list
13+
# Ansible package module skips recommended packages resulting in discrepancies.
1114

1215
# Recommended packages
1316
- tcsh

roles/sap_general_preconfigure/vars/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# dummy entries for passing the arg spec validation:
55
__sap_general_preconfigure_packagegroups: ''
66
__sap_general_preconfigure_envgroups: ''
7+
__sap_general_preconfigure_patterns: []
78
__sap_general_preconfigure_packages: []
89
__sap_general_preconfigure_size_of_tmpfs_gb: ''
910
__sap_general_preconfigure_kernel_parameters_default: []

0 commit comments

Comments
 (0)