Skip to content

Commit b83bffb

Browse files
authored
Merge pull request sap-linuxlab#1125 from marcelmamula/swpm_sapcar
sap_swm: Enhance detection of multiple files
2 parents 9b773dd + ec3628a commit b83bffb

14 files changed

Lines changed: 620 additions & 282 deletions

File tree

roles/sap_swpm/README.md

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -675,61 +675,6 @@ Define to limit number of parallel extraction SAP HANA jobs.
675675

676676
Define password for Diagnostic Agent.
677677

678-
#### sap_swpm_igs_path
679-
- _Type:_ `string`
680-
- _Default:_ `{{ sap_swpm_software_path }}`
681-
682-
Define individual path for SAP IGS file. `sap_swpm_software_path` is used by default.
683-
684-
#### sap_swpm_igs_file_name
685-
- _Type:_ `string`
686-
687-
Define individual name of SAP IGS file. Newest file is auto-detected in `sap_swpm_igs_path`.
688-
689-
#### sap_swpm_igs_helper_path
690-
- _Type:_ `string`
691-
- _Default:_ `{{ sap_swpm_software_path }}`
692-
693-
Define individual path for SAP IGS Helper file. `sap_swpm_software_path` is used by default.
694-
695-
#### sap_swpm_igs_helper_file_name
696-
- _Type:_ `string`
697-
698-
Define individual name of SAP IGS Helper file. Newest file is auto-detected in `sap_swpm_igs_helper_path`.
699-
700-
#### sap_swpm_kernel_dependent_path
701-
- _Type:_ `string`
702-
- _Default:_ `{{ sap_swpm_software_path }}`
703-
704-
Define individual path for Database dependent kernel files. `sap_swpm_software_path` is used by default.
705-
706-
#### sap_swpm_kernel_dependent_file_name
707-
- _Type:_ `string`
708-
709-
Define individual name of Database dependent kernel file. Newest file is auto-detected in `sap_swpm_kernel_dependent_path`.
710-
711-
#### sap_swpm_kernel_independent_path
712-
- _Type:_ `string`
713-
- _Default:_ `{{ sap_swpm_software_path }}`
714-
715-
Define individual path for Database independent kernel files. `sap_swpm_software_path` is used by default.
716-
717-
#### sap_swpm_kernel_independent_file_name
718-
- _Type:_ `string`
719-
720-
Define individual name of Database independent kernel file. Newest file is auto-detected in `sap_swpm_kernel_independent_path`.
721-
722-
#### sap_swpm_web_dispatcher_path
723-
- _Type:_ `string`
724-
- _Default:_ `{{ sap_swpm_software_path }}`
725-
726-
Define individual path for SAP Web Dispatcher files. `sap_swpm_software_path` is used by default.
727-
728-
#### sap_swpm_web_dispatcher_file_name
729-
- _Type:_ `string`
730-
731-
Define individual name of SAP Web Dispatcher file. Newest file is auto-detected in `sap_swpm_web_dispatcher_path`.
732-
733678
#### sap_swpm_fqdn
734679
- _Type:_ `string`
735680

roles/sap_swpm/defaults/main.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -407,21 +407,6 @@ sap_swpm_parallel_jobs_nr: '23'
407407

408408
sap_swpm_diagnostics_agent_password: ''
409409

410-
411-
## --- Individual Software Paths --- ##
412-
# will follow sap_swpm_software_path
413-
# alternatively, can be detected and set with sap_install_media_detect Ansible Role
414-
415-
sap_swpm_igs_path: ''
416-
sap_swpm_igs_file_name: ''
417-
sap_swpm_igs_helper_path: ''
418-
sap_swpm_igs_helper_file_name: ''
419-
sap_swpm_kernel_dependent_path: ''
420-
sap_swpm_kernel_dependent_file_name: ''
421-
sap_swpm_kernel_independent_path: ''
422-
sap_swpm_kernel_independent_file_name: ''
423-
sap_swpm_web_dispatcher_path: ''
424-
sap_swpm_web_dispatcher_file_name: ''
425410
sap_swpm_fqdn: ''
426411
sap_swpm_set_fqdn: true
427412

roles/sap_swpm/tasks/pre_install.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -325,16 +325,25 @@
325325

326326
- name: SAP SWPM - Display Software
327327
ansible.builtin.debug:
328-
msg:
329-
- " SAPEXEDB - {{ sap_swpm_kernel_dependent_path }}/{{ sap_swpm_kernel_dependent_file_name }} "
330-
- " SAPEXE - {{ sap_swpm_kernel_independent_path }}/{{ sap_swpm_kernel_independent_file_name }} "
331-
- " IGS Helper - {{ sap_swpm_igs_helper_path }}/{{ sap_swpm_igs_helper_file_name }} "
332-
- " IGS - {{ sap_swpm_igs_path }}/{{ sap_swpm_igs_file_name }} "
333-
- " WEBDISP - {{ sap_swpm_web_dispatcher_path }}/{{ sap_swpm_web_dispatcher_file_name }} "
334-
- " SAPCAR - {{ sap_swpm_sapcar_path }}/{{ sap_swpm_sapcar_file_name }} "
335-
- " SWPM - {{ sap_swpm_swpm_path }}/{{ sap_swpm_swpm_sar_file_name }} "
336-
- " MP Stack - {{ (sap_swpm_mp_stack_path | d('', true) + '/' + sap_swpm_mp_stack_file_name | d('', true)) | regex_replace('//*', '/') }}"
337-
- " Backup - {{ sap_swpm_backup_location }} "
328+
msg: |
329+
SAPCAR: {{ sap_swpm_sapcar_path }}: {{ __sap_swpm_fact_sapcar_file_name }}
330+
SWPM: {{ sap_swpm_swpm_path }}: {{ __sap_swpm_fact_swpm_sar_file_name }}
331+
{% if not sap_swpm_generic %}
332+
SAPEXEDB: {{ sap_swpm_software_path }}: {{ __sap_swpm_register_sapexedb_files.files | map(attribute='path') | map('basename') | join(', ') | d('') }}
333+
SAPEXE: {{ sap_swpm_software_path }}: {{ __sap_swpm_register_sapexe_files.files | map(attribute='path') | map('basename') | join(', ') | d('') }}
334+
IGS: {{ sap_swpm_software_path }}: {{ __sap_swpm_register_igs_exe_files.files | map(attribute='path') | map('basename') | join(', ') | d('') }}
335+
IGS Helper: {{ sap_swpm_software_path }}: {{ __sap_swpm_register_igs_helper_files.files | map(attribute='path') | map('basename') | join(', ') | d('') }}
336+
{% if 'Webdispatcher' in sap_swpm_product_catalog_id | string %}
337+
WEBDISP: {{ sap_swpm_software_path }}: {{ __sap_swpm_register_sapwebdisp_files.files | map(attribute='path') | map('basename') | join(', ') | d('') }}
338+
{% endif %}
339+
{% endif %}
340+
{% if sap_swpm_swpm_installation_type in ['maint_plan_stack', 'ha_maint_plan_stack'] %}
341+
MP Stack: {{ (sap_swpm_mp_stack_path | d('', true) + '/' + sap_swpm_mp_stack_file_name | d('', true)) | regex_replace('//*', '/') }}"
342+
{% endif %}
343+
{% if sap_swpm_backup_location is defined and sap_swpm_backup_location | string | trim | length > 0 %}
344+
Backup: {{ sap_swpm_backup_location }}
345+
{% endif %}
346+
338347
339348
- name: SAP SWPM - Installation Process
340349
ansible.builtin.debug:

roles/sap_swpm/tasks/pre_install/prepare_software.yml

Lines changed: 22 additions & 200 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
- name: SAP SWPM Pre Install - Ensure correct permissions and ownership of all directories
3535
ansible.builtin.file:
3636
path: "{{ line_item }}"
37-
recurse: no
37+
recurse: false
3838
mode: "{{ sap_swpm_software_directory_mode }}"
3939
owner: "{{ sap_swpm_software_directory_owner }}"
4040
group: "{{ sap_swpm_software_directory_group }}"
@@ -76,219 +76,41 @@
7676
- __sap_swpm_register_find_result_files_non_sapcar is defined
7777

7878

79-
# SAPCAR Path
80-
81-
- name: SAP SWPM Pre Install - Check availability of SAPCAR path - {{ sap_swpm_sapcar_path }}
82-
ansible.builtin.stat:
83-
path: "{{ sap_swpm_sapcar_path | d(sap_swpm_software_path) }}"
84-
register: sap_swpm_sapcar_path_stat
85-
failed_when: not sap_swpm_sapcar_path_stat.stat.exists
86-
87-
- name: SAP SWPM Pre Install - Change ownership of SAPCAR path - {{ sap_swpm_sapcar_path }}
88-
ansible.builtin.file:
89-
path: "{{ sap_swpm_sapcar_path }}"
90-
state: directory
91-
recurse: no
92-
mode: "{{ sap_swpm_software_directory_mode }}"
93-
owner: "{{ sap_swpm_software_directory_owner }}"
94-
group: "{{ sap_swpm_software_directory_group }}"
95-
when: sap_swpm_set_file_permissions
96-
97-
# SWPM Path
98-
99-
- name: SAP SWPM Pre Install - Check availability of SWPM path - {{ sap_swpm_swpm_path }}
100-
ansible.builtin.stat:
101-
path: "{{ sap_swpm_swpm_path | d(sap_swpm_software_path) }}"
102-
register: sap_swpm_swpm_path_stat
103-
failed_when: not sap_swpm_swpm_path_stat.stat.exists
104-
105-
- name: SAP SWPM Pre Install - Change ownership of SWPM path - {{ sap_swpm_swpm_path }}
106-
ansible.builtin.file:
107-
path: "{{ sap_swpm_swpm_path }}"
108-
state: directory
109-
recurse: no
110-
mode: "{{ sap_swpm_software_directory_mode }}"
111-
owner: "{{ sap_swpm_software_directory_owner }}"
112-
group: "{{ sap_swpm_software_directory_group }}"
113-
when:
114-
- sap_swpm_swpm_path != sap_swpm_software_path
115-
- sap_swpm_set_file_permissions
116-
117-
11879
################
11980
# Get software files from software paths
12081
################
12182

122-
# 1. SAPCAR
83+
- name: SAP SWPM Pre Install - Prepare SAPCAR files
84+
ansible.builtin.include_tasks:
85+
file: software/sapcar.yml
12386

124-
- name: SAP SWPM Pre Install - Get SAPCAR from {{ sap_swpm_sapcar_path }}
125-
ansible.builtin.shell: |
126-
ls SAPCAR*.EXE
127-
args:
128-
chdir: "{{ sap_swpm_sapcar_path }}"
129-
register: sap_swpm_sapcar_file_name_get
130-
changed_when: false
87+
- name: SAP SWPM Pre Install - Prepare SWPM files
88+
ansible.builtin.include_tasks:
89+
file: software/swpm.yml
13190

132-
- name: SAP SWPM Pre Install - Set fact for SAPCAR
133-
ansible.builtin.set_fact:
134-
sap_swpm_sapcar_file_name: "{{ sap_swpm_sapcar_file_name_get.stdout }}"
135-
136-
- name: SAP SWPM Pre Install - Check availability of SAPCAR - {{ sap_swpm_sapcar_path + '/' + sap_swpm_sapcar_file_name }}
137-
ansible.builtin.stat:
138-
path: "{{ sap_swpm_sapcar_path }}/{{ sap_swpm_sapcar_file_name }}"
139-
register: sap_swpm_sapcar_file_name_stat
140-
failed_when: not sap_swpm_sapcar_file_name_stat.stat.exists
141-
142-
- name: SAP SWPM Pre Install - Ensure correct permissions and ownership of the SAPCAR*EXE file
143-
ansible.builtin.file:
144-
path: "{{ sap_swpm_sapcar_path }}/{{ sap_swpm_sapcar_file_name }}"
145-
recurse: no
146-
mode: "{{ sap_swpm_files_sapcar_mode }}"
147-
owner: "{{ sap_swpm_files_sapcar_owner }}"
148-
group: "{{ sap_swpm_files_sapcar_group }}"
149-
when: sap_swpm_set_file_permissions
150-
151-
# 2. SWPM
152-
153-
- name: SAP SWPM Pre Install - Get SWPM from {{ sap_swpm_swpm_path }}
154-
ansible.builtin.shell: |
155-
ls SWPM*.SAR
156-
args:
157-
chdir: "{{ sap_swpm_swpm_path }}"
158-
register: sap_swpm_swpm_sar_file_name_get
159-
changed_when: false
160-
161-
- name: SAP SWPM Pre Install - Set fact for SWPM
162-
ansible.builtin.set_fact:
163-
sap_swpm_swpm_sar_file_name: "{{ sap_swpm_swpm_sar_file_name_get.stdout }}"
164-
165-
- name: SAP SWPM Pre Install - Check availability of SWPM - {{ sap_swpm_swpm_path + '/' + sap_swpm_swpm_sar_file_name }}
166-
ansible.builtin.stat:
167-
path: "{{ sap_swpm_swpm_path }}/{{ sap_swpm_swpm_sar_file_name }}"
168-
register: sap_swpm_swpm_sar_file_name_stat
169-
failed_when: not sap_swpm_swpm_sar_file_name_stat.stat.exists
170-
171-
# Note: We use the permissions and ownership settings for non-SAPCAR*EXE files:
172-
- name: SAP SWPM Pre Install - Ensure correct permissions and ownership of the SWPM*SAR file
173-
ansible.builtin.file:
174-
path: "{{ sap_swpm_swpm_path }}/{{ sap_swpm_swpm_sar_file_name }}"
175-
recurse: no
176-
mode: "{{ sap_swpm_files_non_sapcar_mode }}"
177-
owner: "{{ sap_swpm_files_non_sapcar_owner }}"
178-
group: "{{ sap_swpm_files_non_sapcar_group }}"
179-
when:
180-
- sap_swpm_swpm_path != sap_swpm_software_path
181-
- sap_swpm_set_file_permissions
18291

18392
- name: SAP SWPM Pre Install - Full SAP System
18493
when: not sap_swpm_generic
18594
block:
18695

187-
# 3. IGS
96+
- name: SAP SWPM Pre Install - Check IGS files
97+
ansible.builtin.include_tasks:
98+
file: software/igsexe.yml
18899

189-
- name: SAP SWPM Pre Install - Get IGS from software path
190-
ansible.builtin.shell: |
191-
ls igsexe*.sar
192-
args:
193-
chdir: "{{ sap_swpm_software_path }}"
194-
register: sap_swpm_igs_file_name_get
195-
changed_when: false
100+
- name: SAP SWPM Pre Install - Check IGS Helper files
101+
ansible.builtin.include_tasks:
102+
file: software/igshelper.yml
196103

197-
- name: SAP SWPM Pre Install - Set fact for IGS
198-
ansible.builtin.set_fact:
199-
sap_swpm_igs_path: "{{ sap_swpm_software_path }}"
200-
sap_swpm_igs_file_name: "{{ sap_swpm_igs_file_name_get.stdout }}"
104+
- name: SAP SWPM Pre Install - Check SAPEXEDB files
105+
ansible.builtin.include_tasks:
106+
file: software/sapexedb.yml
201107

202-
- name: SAP SWPM Pre Install - Check availability of IGS - {{ sap_swpm_igs_path + '/' + sap_swpm_igs_file_name }}
203-
ansible.builtin.stat:
204-
path: "{{ sap_swpm_igs_path }}/{{ sap_swpm_igs_file_name }}"
205-
register: sap_swpm_igs_file_name_stat
206-
failed_when: not sap_swpm_igs_file_name_stat.stat.exists
108+
- name: SAP SWPM Pre Install - Check SAPEXE files
109+
ansible.builtin.include_tasks:
110+
file: software/sapexe.yml
207111

208-
# 4. IGS Helper
209112

210-
- name: SAP SWPM Pre Install - Get IGS Helper from software path
211-
ansible.builtin.shell: |
212-
ls igshelper*.sar
213-
args:
214-
chdir: "{{ sap_swpm_software_path }}"
215-
register: sap_swpm_igs_helper_file_name_get
216-
changed_when: false
217-
218-
- name: SAP SWPM Pre Install - Set fact for IGS
219-
ansible.builtin.set_fact:
220-
sap_swpm_igs_helper_path: "{{ sap_swpm_software_path }}"
221-
sap_swpm_igs_helper_file_name: "{{ sap_swpm_igs_helper_file_name_get.stdout }}"
222-
223-
- name: SAP SWPM Pre Install - Check availability of IGS Helper - {{ sap_swpm_igs_helper_path + '/' + sap_swpm_igs_helper_file_name }}
224-
ansible.builtin.stat:
225-
path: "{{ sap_swpm_igs_helper_path }}/{{ sap_swpm_igs_helper_file_name }}"
226-
register: sap_swpm_igs_helper_file_name_stat
227-
failed_when: not sap_swpm_igs_helper_file_name_stat.stat.exists
228-
229-
# 5. SAPEXEDB
230-
231-
- name: SAP SWPM Pre Install - Get SAPEXEDB from software path
232-
ansible.builtin.shell: |
233-
ls SAPEXEDB_*.SAR
234-
args:
235-
chdir: "{{ sap_swpm_software_path }}"
236-
register: sap_swpm_kernel_dependent_file_name_get
237-
changed_when: false
238-
239-
- name: SAP SWPM Pre Install - Set fact for SAPEXEDB
240-
ansible.builtin.set_fact:
241-
sap_swpm_kernel_dependent_path: "{{ sap_swpm_software_path }}"
242-
sap_swpm_kernel_dependent_file_name: "{{ sap_swpm_kernel_dependent_file_name_get.stdout }}"
243-
244-
- name: SAP SWPM Pre Install - Check availability of SAPEXEDB - {{ sap_swpm_kernel_dependent_path + '/' + sap_swpm_kernel_dependent_file_name }}
245-
ansible.builtin.stat:
246-
path: "{{ sap_swpm_kernel_dependent_path }}/{{ sap_swpm_kernel_dependent_file_name }}"
247-
register: sap_swpm_kernel_dependent_file_name_stat
248-
failed_when: not sap_swpm_kernel_dependent_file_name_stat.stat.exists
249-
250-
# 6. SAPEXE
251-
252-
- name: SAP SWPM Pre Install - Get SAPEXE from software path
253-
ansible.builtin.shell: |
254-
ls SAPEXE_*.SAR
255-
args:
256-
chdir: "{{ sap_swpm_software_path }}"
257-
register: sap_swpm_kernel_independent_file_name_get
258-
changed_when: false
259-
260-
- name: SAP SWPM Pre Install - Set fact for SAPEXE
261-
ansible.builtin.set_fact:
262-
sap_swpm_kernel_independent_path: "{{ sap_swpm_software_path }}"
263-
sap_swpm_kernel_independent_file_name: "{{ sap_swpm_kernel_independent_file_name_get.stdout }}"
264-
265-
- name: SAP SWPM Pre Install - Check availability of SAPEXE - {{ sap_swpm_kernel_independent_path + '/' + sap_swpm_kernel_independent_file_name }}
266-
ansible.builtin.stat:
267-
path: "{{ sap_swpm_kernel_independent_path }}/{{ sap_swpm_kernel_independent_file_name }}"
268-
register: sap_swpm_kernel_independent_file_name_stat
269-
failed_when: not sap_swpm_kernel_independent_file_name_stat.stat.exists
270-
271-
- name: SAP SWPM Pre Install - Webdispatcher
113+
- name: SAP SWPM Pre Install - Check Webdispatcher files
114+
ansible.builtin.include_tasks:
115+
file: software/sapwebdisp.yml
272116
when: "'Webdispatcher' in sap_swpm_product_catalog_id | string"
273-
block:
274-
275-
# 7. Web Dispatcher
276-
277-
- name: SAP SWPM Pre Install - Get WEBDISP from software path
278-
ansible.builtin.shell: |
279-
ls SAPWEBDISP_*.SAR
280-
args:
281-
chdir: "{{ sap_swpm_software_path }}"
282-
register: sap_swpm_web_dispatcher_file_name_get
283-
changed_when: false
284-
285-
- name: SAP SWPM Pre Install - Set fact for WEBDISP
286-
ansible.builtin.set_fact:
287-
sap_swpm_web_dispatcher_path: "{{ sap_swpm_software_path }}"
288-
sap_swpm_web_dispatcher_file_name: "{{ sap_swpm_web_dispatcher_file_name_get.stdout }}"
289-
290-
- name: SAP SWPM Pre Install - Check availability of WEBDISP - {{ sap_swpm_web_dispatcher_path + '/' + sap_swpm_web_dispatcher_file_name }}
291-
ansible.builtin.stat:
292-
path: "{{ sap_swpm_web_dispatcher_path }}/{{ sap_swpm_web_dispatcher_file_name }}"
293-
register: sap_swpm_web_dispatcher_file_name_stat
294-
failed_when: not sap_swpm_web_dispatcher_file_name_stat.stat.exists
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
---
3+
4+
# Auto-detection checks:
5+
# 1. Check if there is one or more files present.
6+
# NOTE: This is SAR file and it could be extracted to check for 'ansible_architecture',
7+
# but it is not mandatory and it will be handled by 'sapinst'.
8+
9+
- name: SAP SWPM Pre Install - Find all IGS files in {{ sap_swpm_software_path }}
10+
ansible.builtin.find:
11+
paths: "{{ sap_swpm_software_path }}"
12+
patterns: 'igsexe*.sar'
13+
register: __sap_swpm_register_igs_exe_files
14+
15+
- name: SAP SWPM Pre Install - Assert that IGS files were found
16+
ansible.builtin.assert:
17+
that:
18+
- __sap_swpm_register_igs_exe_files.files | length > 0
19+
success_msg: |
20+
SUCCESS: IGS 'igsexe' files were found in '{{ sap_swpm_software_path }}'.
21+
Files: {{ __sap_swpm_register_igs_exe_files.files | map(attribute='path') | map('basename') | join(', ') }}
22+
They are not validated for compatibility with OS architecture '{{ ansible_architecture }}'.
23+
fail_msg: |
24+
FAIL: No IGS 'igsexe' files were found in '{{ sap_swpm_software_path }}'!

0 commit comments

Comments
 (0)