The Ansible Module maintenance_planner_files connects to the SAP Maintenance Planner to retrieve a list of all downloadable files associated with a specific transaction.
- It returns a list containing direct download links and filenames for each file.
- This is useful for automating the download of a complete stack file set defined in a Maintenance Planner transaction.
This module 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 module follows a clear logic flow to retrieve the file list from a Maintenance Planner transaction.
-
Authentication:
- The module first authenticates with the provided S-User credentials to establish a general session with the SAP Launchpad.
- It then performs a second authentication step against the
userapps.support.sap.comservice, which is required to access the Maintenance Planner API.
-
Transaction Lookup:
- The module fetches a list of all Maintenance Planner transactions available to the user.
- It searches this list for a transaction that matches the provided
transaction_name(checking both the name and the display ID). If no match is found, the module fails.
-
File List Retrieval:
- Using the ID of the found transaction, the module makes an API call to retrieve the stack XML file that defines all the downloadable files for that transaction.
- It parses this XML to extract a list of direct download links and their corresponding filenames.
-
URL Validation (Optional):
- If
validate_urlis set totrue, the module will perform aHEADrequest for each download link to verify that it is active and accessible. If any link is invalid, the module will fail.
- If
-
Return Data:
- The module returns the final list of files as the
download_basket, with each item containing aDirectLinkand aFilename.
- The module returns the final list of files as the
NOTE: The Python versions in these examples vary by operating system. Always use the version that is compatible with your specific system or managed node.
To simplify this process, the Ansible Rolesap_launchpad.sap_software_downloadwill install the correct Python version and required modules for you.
Obtain list of SAP Software files using existing System Python.
---
- name: Example play for Ansible Module maintenance_planner_files
hosts: all
tasks:
- name: Obtain list of SAP Software files
community.sap_launchpad.maintenance_planner_files:
suser_id: "Enter SAP S-User ID"
suser_password: "Enter SAP S-User Password"
transaction_name: "Transaction Name or Display ID from Maintenance Planner"
register: __module_resultsObtain list of SAP Software files using existing Python Virtual Environment /tmp/python_venv.
---
- name: Example play for Ansible Module maintenance_planner_files
hosts: all
tasks:
- name: Obtain list of SAP Software files using Python Virtual Environment
community.sap_launchpad.maintenance_planner_files:
suser_id: "Enter SAP S-User ID"
suser_password: "Enter SAP S-User Password"
transaction_name: "Transaction Name or Display ID from Maintenance Planner"
register: __module_results
environment:
PATH: "/tmp/python_venv:{{ ansible_facts['env'].PATH }}"
PYTHONPATH: "/tmp/python_venv/lib/python3.11/site-packages"
VIRTUAL_ENV: "/tmp/python_venv"
vars:
ansible_python_interpreter: "/tmp/python_venv/bin/python3.11 }}"Install prerequisites and obtain list of SAP Software files using existing System Python.
NOTE: Python modules are installed as packages to avoid externally-managed-environment error.
---
- name: Example play for Ansible Module maintenance_planner_files
hosts: all
tasks:
- name: Install Python and Python package manager pip
ansible.builtin.package:
name:
- python311
- python311-pip
state: present
- name: Install Python module packages
ansible.builtin.package:
name:
- python311-wheel
- python311-urllib3
- python311-requests
- python311-beautifulsoup4
- python311-lxml
state: present
- name: Obtain list of SAP Software files
community.sap_launchpad.maintenance_planner_files:
suser_id: "Enter SAP S-User ID"
suser_password: "Enter SAP S-User Password"
transaction_name: "Transaction Name or Display ID from Maintenance Planner"
register: __module_resultsInstall prerequisites and obtain list of SAP Software files using existing Python Virtual Environment /tmp/python_venv.
---
- name: Example play for Ansible Module maintenance_planner_files
hosts: all
tasks:
- name: Install Python and Python package manager pip
ansible.builtin.package:
name:
- python311
- python311-pip
state: present
- name: Install Python modules to Python venv
ansible.builtin.pip:
name:
- wheel
- urllib3
- requests
- beautifulsoup4
- lxml
virtualenv: "/tmp/python_venv"
virtualenv_command: "python3.11 -m venv"
- name: Obtain list of SAP Software files using Python Virtual Environment
community.sap_launchpad.maintenance_planner_files:
suser_id: "Enter SAP S-User ID"
suser_password: "Enter SAP S-User Password"
transaction_name: "Transaction Name or Display ID from Maintenance Planner"
register: __module_results
environment:
PATH: "/tmp/python_venv:{{ ansible_facts['env'].PATH }}"
PYTHONPATH: "/tmp/python_venv/lib/python3.11/site-packages"
VIRTUAL_ENV: "/tmp/python_venv"
vars:
ansible_python_interpreter: "/tmp/python_venv/bin/python3.11 }}"- Type:
string
The status of execution.
- Type:
listwith elements of typedictionary
A Json list of software download links and filenames.
- DirectLink: https://softwaredownloads.sap.com/file/0020000001739942021
Filename: IMDB_SERVER20_060_0-80002031.SAR
- DirectLink: https://softwaredownloads.sap.com/file/0010000001440232021
Filename: KD75379.SARApache 2.0
Maintainers are shown within /docs/contributors.
- Required:
true - Type:
string
The SAP S-User ID with download authorization for SAP software.
- Required:
true - Type:
string
The password for the SAP S-User specified in suser_id.
- Required:
true - Type:
string
The name or display ID of a transaction from the SAP Maintenance Planner.
- Type:
boolean
Validate if the download links are available and not expired.