The Ansible Role sap_software_download is used to download SAP Software Media from SAP.
This role requires the following Python modules to be installed on the target node (the machine where SAP software will be downloaded):
- wheel
- urllib3
- requests
- beautifulsoup4
- lxml
The role installs these modules if they are not already present. Installation can be done in one of the following ways:
- Virtual Environment (Default):
- When
sap_software_download_use_venvistrue(default), a temporary virtual environment is created, and modules are installed viapip. - The Python version is determined by
sap_software_download_python_interpreter.
- When
- System Environment:
- When
sap_software_download_use_venvisfalse, modules are installed directly into the system's Python environment using OS packages specified bysap_software_download_python_module_packages.
- When
The target node must meet the following requirements:
- OS Package Repositories: The operating system must be registered and have access to repositories to install the required Python packages.
- The actual package name is determined by the
sap_software_download_python_packagevariable. - For example, on some systems, these packages might be named
python3andpython3-pip.
- The actual package name is determined by the
- Input Validation: The role first checks if all required input variables have been provided.
- Python Environment Preparation: The role prepares the Python environment:
- Virtual Environment (Default): A temporary Python virtual environment is created, and all necessary dependencies are installed within it.
- System Environment: Alternatively, if
sap_software_download_use_venvis set tofalse, dependencies are installed directly into the system's default Python environment.
- Validate provided S-User credentials The role will search for
SAPCARfile to validate credentials and download authorization. - Maintenance Plan File List: If the
sap_software_download_mp_transactionvariable is provided, the role retrieves the list of files associated with the specified Maintenance Plan transaction. - File Relationship Validation: If
sap_software_download_validate_relationshipsistrue, the role performs validation checks on the relationships between the files to be downloaded.- Alternative File Search: If
sap_software_download_find_alternativesistrue, the role will search for alternative files during relationship validation if the requested files are not found. - More information about validation logic is available at Explanation of relationship validation logic
- Alternative File Search: If
- Maintenance Plan File Download: If
sap_software_download_mp_transactionis provided, the role downloads the files associated with the Maintenance Plan. - Direct File Download: If
sap_software_download_filesis provided, the role downloads the specified files. - Virtual Environment Cleanup: If a temporary Python virtual environment was used, it is removed.
Download of SAP Software files using input list.
---
- name: Ansible Play for downloading SAP Software
hosts: localhost
become: true
tasks:
- name: Include role sap_software_download
ansible.builtin.include_role:
name: community.sap_launchpad.sap_software_download
vars:
sap_software_download_suser_id: "Enter SAP S-User ID"
sap_software_download_suser_password: "Enter SAP S-User Password"
sap_software_download_directory: "/software"
sap_software_download_validate_checksum: true
sap_software_download_files:
- 'SAPCAR_1115-70006178.EXE'
- 'SAPEXE_100-80005509.SAR'Download of SAP Software files using Maintenance Plan.
---
- name: Ansible Play for downloading SAP Software
hosts: localhost
become: true
tasks:
- name: Include role sap_software_download
ansible.builtin.include_role:
name: community.sap_launchpad.sap_software_download
vars:
sap_software_download_suser_id: "Enter SAP S-User ID"
sap_software_download_suser_password: "Enter SAP S-User Password"
sap_software_download_directory: "/software"
sap_software_download_validate_checksum: true
sap_software_download_mp_transaction: 'MY-TRANSACTION-NAME'Combined download of SAP Software files and Maintenance Plan transaction together with settings:
- Use default Python instead of Python virtual environment.
- No validation of S-User credentials.
- No validation of relationships.
- No warnings for unavailable files.
- No warnings for unavailable Maintenance Plan transaction.
- Validate checksum of already existing files with same name.
- name: Ansible Play for downloading SAP Software
hosts: localhost
become: true
tasks:
- name: Include role sap_software_download
ansible.builtin.include_role:
name: community.sap_launchpad.sap_software_download
vars:
sap_software_download_suser_id: "Enter SAP S-User ID"
sap_software_download_suser_password: "Enter SAP S-User Password"
sap_software_download_directory: "/software"
sap_software_download_use_venv: false
sap_software_download_ignore_validate_credentials: true
sap_software_download_ignore_file_not_found: true
sap_software_download_ignore_plan_not_found: true
sap_software_download_validate_relationships: false
sap_software_download_deduplicate: last
sap_software_download_validate_checksum: true
sap_software_download_files:
- 'SAPCAR_1115-70006178.EXE'
- 'SAPEXE_100-80005509.SAR'
sap_software_download_mp_transaction: 'MY-TRANSACTION-NAME'Download of SAP Software files using Python version 3.13.
---
- name: Ansible Play for downloading SAP Software
hosts: localhost
become: true
tasks:
- name: Include role sap_software_download
ansible.builtin.include_role:
name: community.sap_launchpad.sap_software_download
vars:
sap_software_download_python_interpreter: python3.13
sap_software_download_python_package: python313
sap_software_download_python_module_packages:
- python313-wheel
- python313-urllib3
- python313-requests
- python313-beautifulsoup4
- python313-lxml
sap_software_download_suser_id: "Enter SAP S-User ID"
sap_software_download_suser_password: "Enter SAP S-User Password"
sap_software_download_directory: "/software"
sap_software_download_validate_checksum: true
sap_software_download_files:
- 'SAPCAR_1115-70006178.EXE'
- 'SAPEXE_100-80005509.SAR'Validation is executed for known combinations of SAP files, where we can validate their file name, extract versions and compare them.
Supported scenarios:
- SAP HANA file
IMDB_SERVERand components:IMDB_AFL,IMDB_LCAPPS,IMDB_CLIENT. - SAP Kernel file
SAPEXEand components:SAPEXEDB.
Limitations:
- Multiple files for same component are not supported, because relationship validation is designed for one SAP System.
- File contents and manifest are not validated, instead file name is used for validation.
- Compatible operating system is not validated, because unique File ID is different for each component and operating system.
- Searching for alternatives and upgrade candidates will result in longer execution times when
sap_software_download_find_alternativesorsap_software_download_upgrade_relationshipsare set totrue.
- Find all files starting with prefix
IMDB_SERVER,IMDB_AFL,IMDB_LCAPPS,IMDB_CLIENTinsap_software_download_files.- Fail if multiple files with same prefix are found.
- Parse file name of
IMDB_SERVERfile to determine SAP HANA version, revision, patch and file ID. - Attempt to download
IMDB_SERVERfile indry_runmode to validate its availability.- If alternative was found, update software list with new file name.
- Fail if file is not found and the variable
sap_software_download_upgrade_relationshipsis set tofalse.
- Attempt to download upgrade candidate for
IMDB_SERVERfile indry_runmode if previous attempt failed andsap_software_download_upgrade_relationshipsis set totrue.- If upgrade candidate was found, update software list with new file name.
- Fail if file is not found.
- Start validation for detected components
IMDB_AFL,IMDB_LCAPPS,IMDB_CLIENT. Following steps show example forIMDB_AFL. - Parse file name of
IMDB_AFLfile to determine SAP HANA version, revision, patch and file ID.- Fail if
IMDB_AFLis for a different SAP HANA version (e.g.IMDB_AFLfor 1.0 whileIMDB_SERVERis 2.0).
- Fail if
- Attempt to download
IMDB_AFLfile indry_runmode to validate its availability.- If alternative was found, update software list with new file name.
- Fail if file is not found and the variable
sap_software_download_upgrade_relationshipsis set tofalse.
- Create search regex to validate that
IMDB_AFLhas same revision and patch asIMDB_SERVER. - Attempt to download upgrade candidate for
IMDB_AFLfile indry_runmode if previous attempt failed andsap_software_download_upgrade_relationshipsis set totrue. Uses search query based on version details ofIMDB_SERVER.- If upgrade candidate was found, update software list with new file name.
- Fail if file is not found.
- Show summary of validation and fail if validation has failed.
File name versioning breakdown
| File name | Version | Revision | Patch | File ID |
|---|---|---|---|---|
| IMDB_SERVER100_122_35-10009569.SAR | 1.0 | 122 | 35 | 10009569 |
| IMDB_AFL100_122P_3500-10012328.SAR | 1.0 | 122 | 35 | 10012328 |
| IMDB_LCAPPS_122P_3500-20010426.SAR | 1.0 | 122 | 35 | 20010426 |
| IMDB_CLIENT100_120_140-10009663.SAR | 1.0 | N/A | 140 | 10009663 |
| IMDB_SERVER20_089_3-80002031.SAR | 2.0 | 89 | 3 | 80002031 |
| IMDB_AFL20_089P_300-80001894.SAR | 2.0 | 89 | 3 | 80001894 |
| IMDB_LCAPPS_2089P_300-20010426.SAR | 2.0 | 89 | 3 | 20010426 |
| IMDB_CLIENT20_028_22-80002082.SAR | 2.0 | N/A | 22 | 80002082 |
NOTES:
IMDB_AFLandIMDB_LCAPPSexpand patch number when bugfixes are released. Patch1can be1, but if bugfix occurs then all future numbers will be in thousands (e.g.2000for patch2).IMDB_CLIENTis not tied to same Revision and Patch asIMDB_SERVERand other components.
- Find all files starting with prefix
SAPEXEandSAPEXEDBinsap_software_download_files.- Fail if multiple files with same prefix are found.
- Parse file name of
SAPEXEfile to determine SAP Kernel patch and file ID. - Attempt to download
SAPEXEfile indry_runmode to validate its availability.- If alternative was found, update software list with new file name.
- Fail if file is not found and the variable
sap_software_download_upgrade_relationshipsis set tofalse.
- Attempt to download upgrade candidate for
SAPEXEfile indry_runmode if previous attempt failed andsap_software_download_upgrade_relationshipsis set totrue.- If upgrade candidate was found, update software list with new file name.
- Fail if file is not found.
- Start validation for
SAPEXEDB. - Parse file name of
SAPEXEDBfile to determine SAP Kernel patch and file ID. - Attempt to download
SAPEXEDBfile indry_runmode to validate its availability.- If alternative was found, update software list with new file name.
- Fail if file is not found and the variable
sap_software_download_upgrade_relationshipsis set tofalse.
- Create search regex to validate that
SAPEXEDBhas same patch asSAPEXE. - Attempt to download upgrade candidate for
SAPEXEDBfile indry_runmode if previous attempt failed andsap_software_download_upgrade_relationshipsis set totrue. Uses search query based on version details ofSAPEXE.- If upgrade candidate was found, update software list with new file name.
- Fail if file is not found.
- Show summary of validation and fail if validation has failed.
File name versioning breakdown
| File name | Patch | File ID |
|---|---|---|
| SAPEXE_1500-70000596.SAR | 1500 | 70000596 |
| SAPEXEDB_1500-70000612.SAR | 1500 | 70000612 |
NOTES:
- SAP Kernel files do not contain identifier of version in file name, only Patch.
- Actual SAP Kernel version is part of unique File ID and inside of archive. It's validation is not handled by this role.
Apache 2.0
- Type:
string
The SAP S-User ID with download authorization for SAP software.
- Type:
string
The password for the SAP S-User specified in sap_software_download_suser_id.
- Type:
string
The directory where downloaded SAP software files will be stored.
- Type:
listwith elements of typestring
A list of SAP software file names to download.
- Type:
string
The name or display ID of a transaction from the SAP Maintenance Planner.
If provided, the role will download all files associated with this Maintenance Plan transaction.
- Type:
boolean - Default:
true
Enables download of Maintenance Plan Stack XML file together with files.
If set to false, Stack XML file will not be downloaded.
- Type:
boolean - Default:
true
Enables searching for alternative files if the requested file is not found.
Only applies to files specified in sap_software_download_files, not Maintenance Plan files.
If set to false, the role will not search for alternatives.
Example: File IMDB_SERVER20_067_4-80002046.SAR searches for IMDB_SERVER20_067
- Type:
boolean - Default:
false
Enables broader searching for alternative files if the requested file is not found.
Only applies to files specified in sap_software_download_files, not Maintenance Plan files.
Only applies when file was not found with sap_software_download_find_alternatives set to true.
If set to false, the role will not search for upgrade candidates.
Example: File IMDB_SERVER20_067_4-80002046.SAR searches for IMDB_SERVER20_067, IMDB_SERVER20_068, IMDB_SERVER20_
NOTE: Important for when SAP releases new patch for SAP HANA Revision, because:
- Previous patch of
IMDB_SERVERwill be removed and only new patch will be available to download.- Previous patch for other components like
IMDB_AFLwill remain available to download as well as new patch.
- Type:
bool - Default:
false
Determines whether to ignore errors when a requested file is not found.
If set to true, the role will continue execution and download other files, even if some files are not found.
If set to false, the role will fail if any requested file is not found.
- Type:
bool - Default:
false
Determines whether to ignore errors when a specified Maintenance Plan transaction is not found.
If set to true and a Maintenance Plan is not found, the role will continue execution, downloading any files specified in sap_software_download_files.
If set to false, the role will fail if the specified Maintenance Plan is not found.
- Type:
bool - Default:
true
Enables validation of relationships between known combinations of SAP files.
Only applies to files specified in sap_software_download_files, not Maintenance Plan files.
If set to false, no relationship validation will be performed.
See Explanation of relationship validation logic for more information.
- Type:
bool - Default:
false
Enables automatic upgrade of related known combinations of SAP files when leading component version changes.
Only applies when sap_software_download_validate_relationships is set to true.
If set to false, no search for upgrade candidates before validation will be performed.
See Explanation of relationship validation logic for more information.
NOTE: Important for when SAP releases new patch for SAP HANA Revision, because:
- Previous patch of
IMDB_SERVERwill be removed and only new patch will be available to download.- Previous patch for other components like
IMDB_AFLwill remain available to download as well as new patch.
- Type:
bool - Default:
false
Determines whether to ignore warnings during file relationship validation.
If set to true, the role will continue execution even if there are warnings during the validation of file relationships.
If set to false, the role will fail if any warnings are encountered during file relationship validation.
- Type:
bool - Default:
false
Determines whether to ignore validate credentials task.
Disabling this check can lead to locked account, if password is incorrect.
If set to true, the role will continue execution without validating S-User credentials.
If set to false, the role will execute dry run to validate S-User credentials.
- Type:
string - Default:
last
Specifies how to handle duplicate file results when using sap_software_download_files.
If multiple files with the same name are found, this setting determines which one to download.
first: Download the first file foundlast: Download the last file found.'': No deduplication, will cause an error if multiple files with the same name are found.
Can be used to find list of all available files without downloading them.
- Type:
bool - Default:
false
Enables checksum validation of existing files present in sap_software_download_directory.
This does not affect automatic checksum validation of downloaded files.
- Type:
bool - Default:
false
Enables dry_run mode in download tasks instead of actual download.
- Type:
boolean - Default:
true
Determines whether to execute the role within a Python virtual environment.
Using a virtual environment is strongly recommended to isolate dependencies.
If set to false, the role will install Python dependencies directly into the system's Python environment.
- Type:
string - Default: Determined by the supported operating system.
The Python interpreter executable to use when creating a Python virtual environment.
Mandatory when the variable sap_software_download_use_venv is true.
This is the name of the Python executable (e.g., python3.11, python3.9), which may differ from the Python package name.
The default value is determined by the operating system and is set in the corresponding OS-specific variables file.
Examples: python3.11 (SLES 15 SP7), python3.9 (RHEL 8)
- Type:
string - Default: Determined by the supported operating system.
The name of the OS package that provides the desired Python version.
The Python version provided by this package must match the version specified by sap_software_download_python_interpreter.
The default value is determined by the operating system and is set in the corresponding OS-specific variables file.
Examples: python311 (SLES 15 SP7), python3.9 (RHEL 8)
- Type:
listwith elements of typestring - Default: Determined by the supported operating system.
The list of the OS packages that provide modules for the desired Python version.
Required modules are wheel, urllib3, requests, beautifulsoup4, lxml
The listed package versions must match the Python version specified by sap_software_download_python_interpreter.
The default value is determined by the operating system and is set in the corresponding OS-specific variables file.
Examples:
['python311-wheel', 'python311-urllib3', 'python311-requests', 'python311-beautifulsoup4', 'python311-lxml'](SLES 15 SP7)['python3.9-wheel', 'python3.9-urllib3', 'python3.9-requests', 'python3.9-beautifulsoup4', 'python3.9-lxml'](RHEL 8)