The Ansible Module maintenance_planner_stack_xml_download connects to the SAP Maintenance Planner to download the stack.xml file associated with a specific transaction.
- The
stack.xmlfile contains the plan for a system update or installation and is used by tools like Software Update Manager (SUM). - The file is saved to the specified destination directory.
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 download the stack XML file 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.
-
Stack XML Retrieval:
- Using the ID of the found transaction, the module makes an API call to download the raw content of the
stack.xmlfile.
- Using the ID of the found transaction, the module makes an API call to download the raw content of the
-
File Creation:
- The module validates that the provided
destpath is an existing directory. - It determines the filename from the response headers or creates a default name based on the transaction name.
- It writes the retrieved XML content to the destination file.
- The module validates that the provided
-
Return Data:
- The module returns a success message indicating the full path where the
stack.xmlfile was saved.
- The module returns a success message indicating the full path where 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 Stack file using existing System Python.
---
- name: Example play for Ansible Module maintenance_planner_stack_xml_download
hosts: all
tasks:
- name: Obtain Stack file
community.sap_launchpad.maintenance_planner_stack_xml_download:
suser_id: "Enter SAP S-User ID"
suser_password: "Enter SAP S-User Password"
transaction_name: "Transaction Name or Display ID from Maintenance Planner"
dest: "Enter download path (e.g. /software)"
register: __module_resultsObtain Stack file using existing Python Virtual Environment /tmp/venv.
---
- name: Example play for Ansible Module maintenance_planner_stack_xml_download
hosts: all
tasks:
- name: Obtain Stack file using Python Virtual Environment
community.sap_launchpad.maintenance_planner_stack_xml_download:
suser_id: "Enter SAP S-User ID"
suser_password: "Enter SAP S-User Password"
transaction_name: "Transaction Name or Display ID from Maintenance Planner"
dest: "Enter download path (e.g. /software)"
register: __module_results
environment:
PATH: "/tmp/venv:{{ ansiblansible_facts['env']e_env.PATH }}"
PYTHONPATH: "/tmp/venv/lib/python3.11/site-packages"
VIRTUAL_ENV: "/tmp/venv"
vars:
ansible_python_interpreter: "/tmp/venv/bin/python3.11 }}"Install prerequisites and obtain Stack file 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_stack_xml_download
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 Stack file
community.sap_launchpad.maintenance_planner_stack_xml_download:
suser_id: "Enter SAP S-User ID"
suser_password: "Enter SAP S-User Password"
transaction_name: "Transaction Name or Display ID from Maintenance Planner"
dest: "Enter download path (e.g. /software)"
register: __module_resultsInstall prerequisites and obtain Stack file using existing Python Virtual Environment /tmp/python_venv.
---
- name: Example play for Ansible Module maintenance_planner_stack_xml_download
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 Stack file using Python Virtual Environment
community.sap_launchpad.maintenance_planner_stack_xml_download:
suser_id: "Enter SAP S-User ID"
suser_password: "Enter SAP S-User Password"
transaction_name: "Transaction Name or Display ID from Maintenance Planner"
dest: "Enter download path (e.g. /software)"
register: __module_results
environment:
PATH: "/tmp/venv:{{ ansible_facts['env'].PATH }}"
PYTHONPATH: "/tmp/venv/lib/python3.11/site-packages"
VIRTUAL_ENV: "/tmp/venv"
vars:
ansible_python_interpreter: "/tmp/venv/bin/python3.11 }}"- Type:
string
The status of execution.
Apache 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.
- Required:
true - Type:
string
The path to an existing destination directory where the stack.xml file will be saved.