sap.sap_operations.saplikey module – Manage sap license keys for SAP application instance with saplikey program.

Note

This module is part of the sap.sap_operations collection.

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install sap.sap_operations. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: sap.sap_operations.saplikey.

New in sap.sap_operations 1.8.0-galaxy

Synopsis

  • Either filename or license_content should be provided. Filename is a path on the target host where license file is located.

  • If license_content provided, it will be copied to temporary local file and then used for installation. File deleted afterwards.

  • If state is absent, system, hardware_key and product parameters are required.

  • In order to use asterisk as a wildcard in system, hardware_key and product parameters, set allow_asterisk to true. This is to prevent accidental deletion of licenses.

  • Manage sap license keys for SAP application instance with saplikey program.

  • Uses saplikey program to get information about SAP license keys and manage them.

  • saplikey program is a part of SAP kernel

Requirements

The below requirements are needed on the host that executes this module.

  • saplikey program should be installed on the target host

  • Module should be executed on the host where SAP system is installed

  • Module should be executed with <sid>adm user

  • Module should be executed with interactive shell, for that additional parameters should be used: become: true become_user: <sid>adm become_flags: ‘-i’ Flag ‘-i’ is very important, module execution will fail without it. This is because saplikey program heavily relies on environment variables provided by SAP profile.

Parameters

Parameter

Comments

allow_asterisk

boolean

Whether to allow the use of asterisks as wildcards in the system, hardware_key, and product parameters.

This is to prevent accidental deletion of licenses.

Choices:

  • false ← (default)

  • true

filename

path

Path to the license file to install or remove.

hardware_key

string

The hardware key of the SAP system.

license_content

string

The content of the license file to install or remove.

This parameter is not logged.

product

string

The product ID of the SAP system.

profile

path

Profile filename as mentioned in SAP documentation for saplikey program.

Default: "DEFAULT.PFL"

state

string

Whether the license should be present or absent.

Choices:

  • "present" ← (default)

  • "absent"

system

aliases: sid, system_id

string

The system ID of the SAP system.

Or a wildcard asterisk *.

Notes

Note

  • This module is experimental

  • Module interface (parameters, output) might change in future releases

  • Module interface (parameters, output) might change in future patches

  • Module might be removed in future releases

  • Module released only on Ansible galaxy and is not yet planned to be released on Ansible Automation Hub

See Also

See also

SAP Note 181543 - License key for high availability environment

SAP Note 181543 - License key for high availability environment

SAP Note 2755234 - Couldn’t load SAPSECULIB, first temporary license cannot be created by installer

SAP Note 2755234 - Couldn’t load SAPSECULIB, first temporary license cannot be created by installer

sap.sap_operations.saplikey

Manage sap license keys for SAP application instance with saplikey program.

sap.sap_operations.saplikey_show_info

Get information about SAP license keys with saplikey program.

sap.sap_operations.saplikey_get_info

Get host hardware key information and other useful information with saplikey program.

License Administration at Operating System Level with Program saplikey

License Administration at Operating System Level with Program saplikey

Examples

- name: Ensure license keys absent (with asterisks)
  sap.sap_operations.saplikey:
    state: absent
    system: '*'
    hardware_key: '*'
    product: NetWeaver_SYB
    allow_asterisk: true
  become: true
  become_user: <sid>adm
  become_flags: '-i'

- name: Ensure license key present
  sap.sap_operations.saplikey:
    license_content: |
      ----- Begin SAP License -----
  become: true
  become_user: <sid>adm
  become_flags: '-i'

- name: Ensure license key absent that does not exists
  sap.sap_operations.saplikey:
    state: absent
    system: AAA
    hardware_key: doesnotexists
    product: doesnotexists
  become: true
  become_user: <sid>adm
  become_flags: '-i'

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

license_keys

list / elements=dictionary

The list of installed license keys.

Please pay attention that all dates are in format YYYYMMDD.

Please pay attention that all numeric values are returned as strings.

Returned: always

Sample: [{"begin_of_validity": "20230111", "end_of_validity": "20240712", "hardware_key": "D1111111111", "installation_number": "0000000000", "last_successful_check": "20231016", "software_product": "NetWeaver_SYB", "software_product_limit": "2000000000", "system_id": "AAA", "system_number": "000000000000000000", "type_of_license_key": "permanent", "validity": "valid"}, {"begin_of_validity": "20230111", "end_of_validity": "20240712", "hardware_key": "D1111111111", "installation_number": "0000000000", "last_successful_check": "00000000", "software_product": "Maintenance_SYB", "software_product_limit": "2000000000", "system_id": "AAA", "system_number": "000000000000000000", "type_of_license_key": "permanent", "validity": "valid"}]

rc

integer

Return code of the saplikey program execution.

Returned: always

Sample: 0

stderr

string

The standard error of the saplikey program execution.

Returned: always

Sample: ""

stdout

string

The standard output of the saplikey program execution.

Returned: always

Sample: "SAP License Key Administration  -  Copyright (C) 2003 - 2012 SAP AG\n\n1 SAP license key(s) successfully installed.\n"

Authors

  • Kirill Satarin (@kksat)