Giter Club home page Giter Club logo

community.sap_launchpad's Introduction

community.sap_launchpad Ansible Collection Ansible Lint

This Ansible Collection executes basic SAP.com Support operations tasks.

Functionality

This Ansible Collection executes basic SAP.com Support operations tasks, including:

  • Software Center Catalog
    • Search and Download of SAP software center catalog files
    • Search and Extraction of SAP software center catalog information
  • Maintenance Planner
    • Lookup and download files from an existing 'New Implementation' MP Transaction and Stack, using SAP software center's download basket

Contents

An Ansible Playbook can call either an Ansible Role, or the individual Ansible Modules for handling the API calls to various SAP Support Portal API capabilities:

  • Ansible Roles (runs multiple Ansible Modules)
  • Ansible Modules (and adjoining Python Functions)

For further information regarding the development, code structure and execution workflow please read the Development documentation.

Within this Ansible Collection, there are various Ansible Modules.

Ansible Modules

Name                    Summary
sap_launchpad.software_center_download search for files and download
sap_launchpad.maintenance_planner_files maintenance planner files retrieval
sap_launchpad.maintenance_planner_stack_xml_download maintenance planner stack xml download

Execution

Credentials - SAP User ID

SAP software installation media must be obtained from SAP directly, and requires valid license agreements with SAP in order to access these files.

An SAP Company Number (SCN) contains one or more Installation Number/s, providing licences for specified SAP Software. When an SAP User ID is created within the SAP Customer Number (SCN), the administrator must provide SAP Download authorizations for the SAP User ID.

When an SAP User ID (e.g. S-User) is enabled with and part of an SAP Universal ID, then the sap_launchpad Ansible Collection must use:

  • the SAP User ID
  • the password for login with the SAP Universal ID

In addition, if a SAP Universal ID is used then the recommendation is to check and reset the SAP User ID ‘Account Password’ in the SAP Universal ID Account Manager, which will help to avoid any potential conflicts.

For further information regarding connection errors, please see the FAQ section Errors with prefix 'SAP SSO authentication failed - '.

Execution examples

There are various methods to execute the Ansible Collection, dependant on the use case. For more information, see Execution examples with code samples and the summary below:

Execution Scenario Use Case Target
Ansible Playbook
-> source Ansible Collection
-> execute Ansible Task
--> run Ansible Module
---> run Python/Bash Functions
Simple executions with a few activities Localhost or Remote
Ansible Playbook
-> source Ansible Collection
-> execute Ansible Task
--> run Ansible Role
---> run Ansible Module
----> run Python/Bash Functions
--> run Ansible Role
---> ...
Complex executions with various interlinked activities;
run in parallel or sequentially
Localhost or Remote
Python/Bash Functions Simple testing or non-Ansible use cases Localhost

Requirements, Dependencies and Testing

Operating System requirements

Designed for Linux operating systems, e.g. RHEL.

This role has not been tested and amended for SAP NetWeaver Application Server instantiations on IBM AIX or Windows Server.

Assumptions for executing this role include:

  • Registered OS License and OS Package repositories are available (from the relevant content delivery network of the OS vendor)
  • Simultaneous Ansible Playbook executions will require amendment of Ansible Variable name softwarecenter_search_list shown in execution samples (containing the list of installation media to download). This avoids accidental global variable clashes from occuring in Ansible Playbooks executed from the same controller host with an inline Ansible Inventory against 'all' target hosts.

Python requirements

Execution/Controller/Management host:

  • Python 3

Target host:

Testing on execution/controller host

Tests with Ansible Core release versions:

  • Ansible Core 2.11.5 community edition

Tests with Python release versions:

  • Python 3.9.7 (i.e. CPython distribution)

Tests with Operating System release versions:

  • RHEL 8.4
  • macOS 11.6 (Big Sur), with Homebrew used for Python 3.x via PyEnv

Testing on target/remote host

Tests with Operating System release versions:

  • RHEL 8.2 for SAP

Tests with Python release versions:

  • Python 3.6.x (i.e. CPython distribution), default for RHEL 8.x and SLES 15.x
  • Python 3.8.x (i.e. CPython distribution)

License

Contributors

Contributors to the Ansible Roles within this Ansible Collection, are shown within /docs/contributors.

community.sap_launchpad's People

Contributors

berndfinger avatar digglife avatar matthiaswinzeler avatar rainerleber avatar rhmk avatar sean-freeman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

community.sap_launchpad's Issues

feat: add SAP Notes notes download?

Hi, would it be possible to add the ability to download SNOTES from the Support Portal? I have an ansible playbook that needs to get the latest compatible OS-release for the respective HANA version (Note 2235581)

Download with software_center_download fails

I'm trying to use the software_center_download module as part of my playbook. But it fails with the following message:

"An exception has occurred - You do not have proper authorization to download software, please check: https://launchpad.support.sap.com/#/user/authorizations"

First of all I've checked the permissions, my S-User has. They are correctly set and I'm able to download software from SAP using a browser. As suggested when using an Universal ID I also reset my Account Password without any difference. So I tried it again with an S-User of my colleague which has super admin rights and the module worked as expected. His S-User uses a Universal ID, too. The only difference are those super admin rights, which shouldn't prevent me from downloading.

Any ideas how to fix this?

PR for management of Systems/Keys API welcome?

Hi folks

As you probably know, whenever a new SAP system is set up or the underlying VM is recreated, one has to access the launchpad on https://me.sap.com/licensekey, register the new system (or update an existing one) and generate a new license file.

Since we are moving to the cloud, where VMs might be changing more often than traditionally, we'd like to automate the following tasks:

  • List/Create/Update/Delete of Systems in the Launchpad
  • List/Create/Update/Delete of License Keys in the Launchpad

Would you accept a PR that extends this module with the functionality above?

I quickly checked what API is used for managing Systems/License Keys and it appears to be a quite nice ODATA API on https://launchpad.support.sap.com/services/odata/i7p/odata/bkey, which should be rather easy to write a client for.

This API is also protected by the same authorization methods (cookies etc.) as the other APIs compatible in this Ansible Collection, so I thought the new API would fit nicely in your already existing Ansible Modules; I could reuse your foundation and just add a new module that talks to an additional API.

I am not sure how stable the i7p API above is and whether it would break in the future, but I think you have the similar issue with the currently compatible APIs (software download etc.) anyway.

What do you think?

SAP ID SSO: Gigya SDK build number is retrieved multiple times, not cached

Inside sap_id_sso.py is the following code:

def _get_sdk_build_number(api_key):
global GIGYA_SDK_BUILD_NUMBER
if GIGYA_SDK_BUILD_NUMBER is not None:
return GIGYA_SDK_BUILD_NUMBER

This seems to imply caching, however GIGYA_SDK_BUILD_NUMBER is never assigned to and always remains None.
Is there a reason for this? The only argument in that function is the API key, but as of now, for all three invocations it is the same.

Considering the gigya.js is over 500 KB in size and the regex takes fairly long, caching would make sense.
Perhaps that was the plan all along, but assigning to the global was forgotten?

demo paybook fails sso login

failed: [localhost] (item=SAPCAR_1324-80000936.EXE) => {"ansible_loop_var": "item", "changed": false, "item": "SAPCAR_1324-80000936.EXE", "msg": "SAP SSO authentication failed - 401 Client Error: for url: https://core-api.account.sap.com/uid-core/authenticate?reqId=https%3A%2F%2Fhana.ondemand.com%2Fsupportportal"}

Maintenance planner downloads: Deselected files are still downloaded

Hi folks

First of all, many thanks for providing this library! It is an incredibly valuable tool when it comes to automating our SAP Basis deployment pipeline.

I think we found a minor bug in community.sap_launchpad.maintenance_planner_files - it returns files for a download that were deselected in the maintenance planner.

How to reproduce

  1. Access the SAP maintenance planner
  2. Click on "Plan a new system"
  3. Click on "Plan"
  4. Choose a SID and "Install an SAP S/4HANA system"
  5. Select some release, i.e. "SAP S/4HANA 2022" with FPS 02, confirm selection
  6. Go to "Select Files", select Linux X64, confirm selection
  7. If you expand "Select Stack Independent Files" & "NON-ABAP", you will notice that all language stacks other than German (DE) and English (EN) are unselected:
image
  1. When going further to "Download Files", you will see that only German (DE) and English (EN) are selected for download:
image
  1. We finalize the MP part by pushing the downloads to the download basket (not sure this part is necessary)

Now, when listing the files to download with this module, it will not only tell us to download the language packs DE & EN, but all available language packs, even though they were not selected in the MP. I think this is a bug:

...
    - name: Execute Ansible Module 'maintenance_planner_files' to get files from MP
      community.sap_launchpad.maintenance_planner_files:
        suser_id: "{{ suser_id }}"
        suser_password: "{{ suser_password }}"
        transaction_name: "{{ transaction_name }}"
      register: sap_maintenance_planner_basket_register

    - name: Debug
      ansible.builtin.debug:
        var: sap_maintenance_planner_basket_register
        verbosity: 2
...

This will output all language files, even though deselected:

...
    "sap_maintenance_planner_basket_register": {
        "changed": true,
        "download_basket": [
...
            {
                "DirectLink": "https://softwaredownloads.sap.com/file/0030000001312922022",
                "Filename": "S4HANAOP107_ERP_LANG_SL.SAR"
            },
            {
                "DirectLink": "https://softwaredownloads.sap.com/file/0030000001312932022",
                "Filename": "S4HANAOP107_ERP_LANG_SV.SAR"
            },
            {
                "DirectLink": "https://softwaredownloads.sap.com/file/0030000001312942022",
                "Filename": "S4HANAOP107_ERP_LANG_TH.SAR"
            },
            {
                "DirectLink": "https://softwaredownloads.sap.com/file/0030000001312962022",
                "Filename": "S4HANAOP107_ERP_LANG_TR.SAR"
            },
            {
                "DirectLink": "https://softwaredownloads.sap.com/file/0030000001312972022",
                "Filename": "S4HANAOP107_ERP_LANG_UK.SAR"
            },
            {
                "DirectLink": "https://softwaredownloads.sap.com/file/0030000001312982022",
                "Filename": "S4HANAOP107_ERP_LANG_VI.SAR"
            },
            {
                "DirectLink": "https://softwaredownloads.sap.com/file/0030000001312992022",
                "Filename": "S4HANAOP107_ERP_LANG_ZF.SAR"
            },
            {
                "DirectLink": "https://softwaredownloads.sap.com/file/0030000001313002022",
                "Filename": "S4HANAOP107_ERP_LANG_ZH.SAR"
...

To summarize, it appears that the module returns all software packages from the stack, even deselected ones.

I dug a bit deeper into the code and saw that the API call that return the files above returns an XML which also contains the deselected files:

<?xml version="1.0" encoding="utf-16"?>
<mnp:response xmlns:mnp="http://xml.sap.com/2012/01/mnp">
...
 <mnp:entities>
        <mnp:entity id="selectFiles" step="downloadFiles" label="Download Files">
            <mnp:entity id="downloadStackFiles" label="Download Stack Files">
                <mnp:entity label="List of files selected for download" id="stack_files"
                            type="Download Stack Independent Files" enable="false">
                    <mnp:entity id="0010000000033172015" label="GBX01HR5605.SAR" type="REG" size="5"
                                selection_type="multiple" selected="true"
                                description="Attribute Change Package 28 for GBX01HR5 605" enable="false"/>
....
                    <mnp:entity id="0030000001312572022" label="S4HANAOP107_ERP_LANG_CS.SAR" type="STL" size="687978"
                                selection_type="multiple" selected="true" description="File on DVD" enable="false"/>
                    <mnp:entity id="0030000001312582022" label="S4HANAOP107_ERP_LANG_DA.SAR" type="STL" size="475621"
                                selection_type="multiple" selected="true" description="File on DVD" enable="false"/>
                    <mnp:entity id="0030000001312472022" label="S4HANAOP107_ERP_LANG_DE.SAR" type="STL" size="292015"
                                selection_type="multiple" selected="true" description="File on DVD" enable="false"/>
...

As you can see, both S4HANAOP107_ERP_LANG_DE (which was selected in the MP GUI) as well as S4HANAOP107_ERP_LANG_DA.SAR (which was unselected in the MP planner) have selected=true. If the clients are supposed to respect this field, then it might even be a bug in the SAP backend. I am not sure this can easily be fixed, but maybe you folks have a good internal contact working on this part that can take a look?

FWIW, I also checked out the SAP Download Manager (which I assume is the official client for the MP) and it correctly returns only the selected files, but I think it uses a slightly different API than the XML above.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.