sap-linuxlab / community.sap_launchpad

Automation for SAP - Collection of Ansible Modules for various tasks using SAP Launchpad APIs
Apache License 2.0
8 stars 7 forks source link

Create/update systems and license keys #16

Closed MatthiasWinzeler closed 9 months ago

MatthiasWinzeler commented 9 months ago

This PR adds the functionality discussed in issue https://github.com/sap-linuxlab/community.sap_launchpad/issues/15.

Scope

Example

An example usage of the module which allows to idempotently create or update a system and retrieve the license key file:

- name: test license key creation
  hosts: localhost
  tasks:

  - name: get existing system
    community.sap_launchpad.systems_info:
      suser_id: S1234
      suser_password: password
      filter: "Insnr eq '123456789' and sysid eq 'B01' and ProductDescr eq 'SAP S/4HANA'"
    register: result

  - name: create license keys
    community.sap_launchpad.license_keys:
      suser_id: S1234
      suser_password: password
      installation_nr: 123456789
      system:
        nr: "{{ result.systems[0].Sysnr | default(omit) }}"
        product: SAP S/4HANA
        version: SAP S/4HANA 2022
        data:
          sysid: B01
          sysname: Test-System
          systype: Development system
          sysdb: SAP HANA database
          sysos: Linux
          sys_depl: Public - Microsoft Azure
      licenses:
        - type: Standard - Web Application Server ABAP or ABAP+JAVA
          data:
            hwkey: H1234567890
            expdate: 99991231
        - type: Maintenance Entitlement
          data:
            hwkey: H1234567890
            expdate: 99991231
    register: result

  - name: Display the license file containing the licenses
    debug:
      msg:
        - "{{ result.license_file }}"

I tested the following use cases to ensure full idempotency.

Let me know if you need more examples (should we create a sample playbook in the repo?), more extensive documentation or other changes. Please also let me know if I have to sign any CLA. Eager to get your feedback!

rainerleber commented 9 months ago

Hi @MatthiasWinzeler thank you for contributing. I will review this PR soon.

MatthiasWinzeler commented 9 months ago

@rainerleber many thanks for your feedback! I took care of the obvious comments and added follow-up questions where it was unclear to me how we proceed.

rainerleber commented 9 months ago

@MatthiasWinzeler thanks for clarify the questions. Only a few things are left :-) after that we are ready to merge I think.

MatthiasWinzeler commented 9 months ago

@rainerleber thanks - merged your suggestions and responded your other comments. Can you give it a final review?

MatthiasWinzeler commented 9 months ago

@rainerleber FYI, cleanup PR is in https://github.com/sap-linuxlab/community.sap_launchpad/pull/17