Skip to content

Commit

Permalink
Merge pull request sap-linuxlab#461 from berndfinger/issue-385-new-de…
Browse files Browse the repository at this point in the history
…tection-method-further_changes

Issue 385 new detection method - further changes
  • Loading branch information
berndfinger authored Sep 21, 2023
2 parents c9e780a + 2f3d2e1 commit d372ea9
Show file tree
Hide file tree
Showing 9 changed files with 158 additions and 97 deletions.
1 change: 1 addition & 0 deletions roles/sap_install_media_detect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ This role does not depend on any other Ansible Role.
## Tags

With the following tags, the role can be called to perform certain activities only:
- tag `sap_install_media_detect_zip_handling`: Only perform the task for enabling the listing and extracting of files of type `ZIP`.
- tag `sap_install_media_detect_rar_handling`: Only perform the tasks for enabling the listing and extracting of files of type `RAR`. This
includes enabling and disabling the EPEL repo for RHEL systems, if desired.
- tag `sap_install_media_detect_add_file_extension`: Add file name extensions to any files in `sap_install_media_detect_source_directory` which are of type `RAR` or `ZIP` and have no ending. Needs to be used with tag `sap_install_media_detect_create_file_list_phase_1`.
Expand Down
32 changes: 22 additions & 10 deletions roles/sap_install_media_detect/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,32 @@ sap_install_media_detect_move_or_copy_archives: true
# following parameter to 'false' to skip this step.
sap_install_media_detect_assert_after_sapfile: true

# Typical parameter settings for SAP S/4HANA:
sap_install_media_detect_db: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2
sap_install_media_detect_db_client: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2
sap_install_media_detect_swpm: true
sap_install_media_detect_hostagent: true
sap_install_media_detect_igs: true
sap_install_media_detect_kernel: true
sap_install_media_detect_db: '' # saphana, sapase, sapmaxdb, oracledb, ibmdb2
sap_install_media_detect_db_client: '' # saphana, sapase, sapmaxdb, oracledb, ibmdb2
sap_install_media_detect_swpm: false
sap_install_media_detect_hostagent: false
sap_install_media_detect_igs: false
sap_install_media_detect_kernel: false
sap_install_media_detect_kernel_db: '' # saphana, sapase, sapmaxdb, oracledb, ibmdb2
# (only necessary if there is more than one SAPEXEDB file in the source directory)
sap_install_media_detect_webdisp: false
sap_install_media_detect_export: '' # saps4hana, sapbw4hana, sapecc, sapecc_ides,
# sapnwas_abap, sapnwas_java, sapsolman_abap, sapsolman_java

# Example for parameter settings for SAP S/4HANA:
#sap_install_media_detect_db: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2
#sap_install_media_detect_db_client: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2
#sap_install_media_detect_swpm: true
#sap_install_media_detect_hostagent: true
#sap_install_media_detect_igs: true
#sap_install_media_detect_kernel: true
#sap_install_media_detect_kernel_db: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2
# (only necessary if there is more than one SAPEXEDB file in the source directory)
sap_install_media_detect_webdisp: false
sap_install_media_detect_export: 'saps4hana' # saps4hana, sapbw4hana, sapecc, sapecc_ides,
#sap_install_media_detect_webdisp: false
#sap_install_media_detect_export: 'saps4hana' # saps4hana, sapbw4hana, sapecc, sapecc_ides,
# sapnwas_abap, sapnwas_java, sapsolman_abap, sapsolman_java

# Typical parameter settings for SAP ERP 6.0 EHP8 with SAP HANA database:
# Example for parameter settings for SAP ERP 6.0 EHP8 with SAP HANA database:
#sap_install_media_detect_db: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2
#sap_install_media_detect_db_client: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2
#sap_install_media_detect_swpm: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
patterns: "SAP_HANA_CLIENT"
register: sap_hana_client_path
ignore_errors: true
when: sap_install_media_detect_db == "saphana"
when:
- sap_install_media_detect_db == 'saphana' or
sap_install_media_detect_db_client == 'saphana'

- name: SAP Install Media Detect - Find files after extraction - Find IBM Db2
ansible.builtin.find:
Expand All @@ -43,7 +45,7 @@
patterns: ".*LINUXX86_64.*"
use_regex: true
register: detect_directory_ibmdb2_extracted
when: sap_install_media_detect_db == "ibmdb2"
when: sap_install_media_detect_db == 'ibmdb2'

- name: SAP Install Media Detect - Find files after extraction - Find IBM Db2 Client
ansible.builtin.find:
Expand All @@ -53,7 +55,9 @@
patterns: ".*DATA_UNITS.*"
use_regex: true
register: detect_directory_ibmdb2_client_extracted
when: sap_install_media_detect_db == "ibmdb2"
when:
- sap_install_media_detect_db == 'ibmdb2' or
sap_install_media_detect_db_client == 'ibmdb2'

- name: SAP Install Media Detect - Find files after extraction - Find Oracle DB
ansible.builtin.find:
Expand All @@ -63,7 +67,7 @@
patterns: ".*LINUX_X86_64.*"
use_regex: true
register: detect_directory_oracledb_extracted
when: sap_install_media_detect_db == "oracledb"
when: sap_install_media_detect_db == 'oracledb'

- name: SAP Install Media Detect - Find files after extraction - Find Oracle DB Client
ansible.builtin.find:
Expand All @@ -73,7 +77,9 @@
patterns: ".*OCL_LINUX_X86_64.*"
use_regex: true
register: detect_directory_oracledb_client_extracted
when: sap_install_media_detect_db == "oracledb"
when:
- sap_install_media_detect_db == 'oracledb' or
sap_install_media_detect_db_client == 'oracledb'

- name: SAP Install Media Detect - Find files after extraction - Find SAP ASE
ansible.builtin.find:
Expand All @@ -83,7 +89,7 @@
patterns: ".*SYBASE_LINUX.*"
use_regex: true
register: detect_directory_sapase_extracted
when: sap_install_media_detect_db == "sapase"
when: sap_install_media_detect_db == 'sapase'

- name: SAP Install Media Detect - Find files after extraction - Find SAP ASE Client
ansible.builtin.find:
Expand All @@ -93,7 +99,9 @@
patterns: "sybodbc"
use_regex: true
register: detect_directory_sapase_client_extracted
when: sap_install_media_detect_db == "sapase"
when:
- sap_install_media_detect_db == 'sapase' or
sap_install_media_detect_db_client == 'sapase'

- name: SAP Install Media Detect - Find files after extraction - Find SAP MaxDB
ansible.builtin.find:
Expand All @@ -103,7 +111,7 @@
patterns: '.*MaxDB_7.9.*'
use_regex: true
register: detect_directory_sapmaxdb_extracted
when: sap_install_media_detect_db == "sapmaxdb"
when: sap_install_media_detect_db == 'sapmaxdb'

- name: SAP Install Media Detect - Find files after extraction - Find SAPEXE
ansible.builtin.shell: ls SAPEXE_*.SAR
Expand All @@ -121,26 +129,30 @@
- sap_swpm_kernel_independent_file_name_get.stdout_lines | count > 1

- name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB, database unspecific - block
when: sap_install_media_detect_kernel_db is not defined
when:
- sap_install_media_detect_kernel
- sap_install_media_detect_kernel_db is not defined or
sap_install_media_detect_kernel_db | length == 0
block:

- name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB, database unspecific
ansible.builtin.shell: ls SAPEXEDB_*.SAR
args:
chdir: "{{ sap_swpm_software_path }}"
register: sap_swpm_kernel_dependent_file_name_get
register: sap_swpm_kernel_dependent_file_name_get_db_unspecific
changed_when: false
when: sap_install_media_detect_kernel

- name: SAP Install Media Detect - Find files after extraction - Fail if more than one SAPEXEDB file found, database unspecific
ansible.builtin.fail:
msg: "No, or more than one, SAPEXEDB file has been detected."
when:
- sap_install_media_detect_kernel
- sap_swpm_kernel_dependent_file_name_get.stdout_lines | count != 1
- sap_swpm_kernel_dependent_file_name_get_db_unspecific.stdout_lines | count != 1

- name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB, database specific - block
when: sap_install_media_detect_kernel_db is defined
when:
- sap_install_media_detect_kernel
- sap_install_media_detect_kernel_db is defined
- sap_install_media_detect_kernel_db | length > 0
block:

- name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB, database specific
Expand All @@ -149,9 +161,6 @@
chdir: "{{ sap_swpm_software_path }}"
register: __sap_install_media_detect_register_db_dependent_kernel_files
changed_when: false
when:
- sap_install_media_detect_kernel
- sap_install_media_detect_kernel_db is defined

- name: SAP Install Media Detect - Find files after extraction - Set fact with the results of the sapfile command
ansible.builtin.set_fact:
Expand All @@ -171,7 +180,7 @@

- name: SAP Install Media Detect - Find files after extraction - Set the kernel dependent file name for SAP HANA
ansible.builtin.set_fact:
sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_hdb') | first).file }}"
sap_swpm_kernel_dependent_file_name_get_db_specific: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_hdb') | first).file }}"
when:
- sap_install_media_detect_kernel_db == 'saphana'
- __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_hdb') | length == 1
Expand All @@ -185,7 +194,7 @@

- name: SAP Install Media Detect - Find files after extraction - Set the kernel dependent file name for SAP ASE
ansible.builtin.set_fact:
sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ase') | first).file }}"
sap_swpm_kernel_dependent_file_name_get_db_specific: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ase') | first).file }}"
when:
- sap_install_media_detect_kernel_db == 'sapase'
- __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ase') | length == 1
Expand All @@ -199,7 +208,7 @@

- name: SAP Install Media Detect - Find files after extraction - Set the kernel dependent file name for SAP MAXDB
ansible.builtin.set_fact:
sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ada') | first).file }}"
sap_swpm_kernel_dependent_file_name_get_db_specific: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ada') | first).file }}"
when:
- sap_install_media_detect_kernel_db == 'sapmaxdb'
- __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ada') | length == 1
Expand All @@ -213,7 +222,7 @@

- name: SAP Install Media Detect - Find files after extraction - Set the kernel dependent file name for Oracle DB
ansible.builtin.set_fact:
sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ora') | first).file }}"
sap_swpm_kernel_dependent_file_name_get_db_specific: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ora') | first).file }}"
when:
- sap_install_media_detect_kernel_db == 'oracledb'
- __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ora') | length == 1
Expand All @@ -227,7 +236,7 @@

- name: SAP Install Media Detect - Find files after extraction - Set the kernel dependent file name for IBM Db2
ansible.builtin.set_fact:
sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_db6') | first).file }}"
sap_swpm_kernel_dependent_file_name_get_db_specific: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_db6') | first).file }}"
when:
- sap_install_media_detect_kernel_db == 'ibmdb2'
- __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_db6') | length == 1
Expand Down Expand Up @@ -272,7 +281,7 @@
patterns: '.*DATA_UNITS.*'
use_regex: true
register: detect_directory_ecc_export_extracted
when: sap_install_media_detect_export == "sapecc"
when: sap_install_media_detect_export == 'sapecc'

- name: SAP Install Media Detect - Find files after extraction - Find SAP ECC IDES Export
ansible.builtin.find:
Expand All @@ -282,7 +291,7 @@
patterns: '.*EXP.*'
use_regex: true
register: detect_directory_ecc_ides_export_extracted
when: sap_install_media_detect_export == "sapecc_ides"
when: sap_install_media_detect_export == 'sapecc_ides'

- name: SAP Install Media Detect - Find files after extraction - Find SAP S/4HANA Export
ansible.builtin.find:
Expand All @@ -292,7 +301,7 @@
patterns: '.*S4.*EXPORT.*'
use_regex: true
register: s4hana_export_files
when: sap_install_media_detect_export == "saps4hana"
when: sap_install_media_detect_export == 'saps4hana'

- name: SAP Install Media Detect - Find files after extraction - Find SAP BW/4HANA Export
ansible.builtin.find:
Expand All @@ -302,7 +311,7 @@
patterns: '.*BW4.*EXPORT.*'
use_regex: true
register: bw4hana_export_files
when: sap_install_media_detect_export == "sapbw4hana"
when: sap_install_media_detect_export == 'sapbw4hana'

- name: SAP Install Media Detect - Find files after extraction - Find SAP NetWeaver AS (ABAP) platform only Export
ansible.builtin.find:
Expand All @@ -312,7 +321,7 @@
patterns: '.*DATA_UNITS.*'
use_regex: true
register: detect_directory_nwas_abap_export_extracted
when: sap_install_media_detect_export == "sapnwas_abap"
when: sap_install_media_detect_export == 'sapnwas_abap'

- name: SAP Install Media Detect - Find files after extraction - Find SAP NetWeaver AS (JAVA) platform only Export
ansible.builtin.find:
Expand All @@ -322,7 +331,7 @@
patterns: '.*DATA_UNITS.*'
use_regex: true
register: detect_directory_nwas_java_export_extracted
when: sap_install_media_detect_export == "sapnwas_java"
when: sap_install_media_detect_export == 'sapnwas_java'

- name: SAP Install Media Detect - Find files after extraction - Find SAP Solution Manager (ABAP) platform only Export
ansible.builtin.find:
Expand All @@ -332,7 +341,7 @@
patterns: '.*DATA_UNITS.*'
use_regex: true
register: detect_directory_solgmr_abap_export_extracted
when: sap_install_media_detect_export == "sapsolman_abap"
when: sap_install_media_detect_export == 'sapsolman_abap'

- name: SAP Install Media Detect - Find files after extraction - Find SAP Solution Manager (JAVA) platform only Export
ansible.builtin.find:
Expand All @@ -342,4 +351,4 @@
patterns: '.*DATA_UNITS.*'
use_regex: true
register: detect_directory_solgmr_java_export_extracted
when: sap_install_media_detect_export == "sapsolman_java"
when: sap_install_media_detect_export == 'sapsolman_java'
7 changes: 7 additions & 0 deletions roles/sap_install_media_detect/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
tags: sap_install_media_detect_provide_sapfile_utility
tags: sap_install_media_detect_provide_sapfile_utility

- name: SAP Install Media Detect - Prepare - Enable zip handling
ansible.builtin.include_tasks:
file: prepare/enable_zip_handling.yml
apply:
tags: sap_install_media_detect_zip_handling
tags: sap_install_media_detect_zip_handling

- name: SAP Install Media Detect - Prepare - Enable rar handling
ansible.builtin.include_tasks:
file: prepare/enable_rar_handling.yml
Expand Down
4 changes: 2 additions & 2 deletions roles/sap_install_media_detect/tasks/organize_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
loop_var: line_item
when:
- sap_install_media_detect_move_or_copy_archives
- sap_install_media_detect_db == 'saphana'
- sap_install_media_detect_db | d('') == 'saphana'
- line_item.target_dir == 'auto'

- name: SAP Install Media Detect - Organize all files - Create target directory 'sap_swpm_download_basket'
Expand Down Expand Up @@ -178,7 +178,7 @@
loop_var: line_item
when:
- sap_install_media_detect_move_or_copy_archives
- sap_install_media_detect_db == 'saphana'
- sap_install_media_detect_db | d('') == 'saphana'
- (line_item.sap_file_type == 'sapcar' or
line_item.sap_file_type == 'saphana_client' or
line_item.sap_file_type == 'sap_hostagent')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

- name: SAP Install Media Detect - Prepare - Check the status of 'sap_install_media_detect_source_directory'
when: sap_install_media_detect_target_directory is undefined or
sap_install_media_detect_target_directory | string == "None" or
sap_install_media_detect_target_directory | string == 'None' or
sap_install_media_detect_target_directory | string | length == 0
block:

Expand Down
Loading

0 comments on commit d372ea9

Please sign in to comment.