community.general.sap_task_list_execute module – Perform SAP Task list execution

Note

This module is part of the community.general collection (version 4.8.3).

You might already have this collection installed if you are using the ansible package. 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 community.general.

To use it in a playbook, specify: community.general.sap_task_list_execute.

New in version 3.5.0: of community.general

Synopsis

  • The sap_task_list_execute module depends on pyrfc Python library (version 2.4.0 and upwards). Depending on distribution you are using, you may need to install additional packages to have these available.

  • Tasks in the task list which requires manual activities will be confirmed automatically.

  • This module will use the RFC package STC_TM_API.

Requirements

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

  • pyrfc >= 2.4.0

  • xmltodict

Parameters

Parameter

Comments

client

string

The client number to connect to.

You must quote the value to ensure retaining the leading zeros.

Default: “000”

conn_password

string / required

The required password for the SAP system.

conn_username

string / required

The required username for the SAP system.

host

string / required

The required host for the SAP system. Can be either an FQDN or IP Address.

sysnr

string

The system number of the SAP system.

You must quote the value to ensure retaining the leading zeros.

Default: “00”

task_parameters

list / elements=dictionary

The tasks and the parameters for execution.

If the task list do not need any parameters. This could be empty.

If only specific tasks from the task list should be executed. The tasks even when no parameter is needed must be provided. Alongside with the module parameter task_skip=true.

FIELDNAME

string

The name of the field of the task.

TASKNAME

string / required

The name of the task in the task list.

VALUE

raw

The value which have to be set.

task_settings

list / elements=string

Setting for the execution of the task list. This can be the following as in TCODE SE80 described. Check Mode CHECKRUN, Background Processing Active BATCH (this is the default value), Asynchronous Execution ASYNC, Trace Mode TRACE, Server Name BATCH_TARGET.

Default: [“BATCH”]

task_skip

boolean

If this parameter is true not defined tasks in task_parameters are skipped.

This could be the case when only certain tasks should run from the task list.

Choices:

  • no ← (default)

  • yes

task_to_execute

string / required

The task list which will be executed.

Notes

Note

  • Does not support check_mode.

Examples

# Pass in a message
- name: Test task execution
  community.general.sap_task_list_execute:
    conn_username: DDIC
    conn_password: Passwd1234
    host: 10.1.8.10
    sysnr: '01'
    client: '000'
    task_to_execute: SAP_BASIS_SSL_CHECK
    task_settings: batch

- name: Pass in input parameters
  community.general.sap_task_list_execute:
    conn_username: DDIC
    conn_password: Passwd1234
    host: 10.1.8.10
    sysnr: '00'
    client: '000'
    task_to_execute: SAP_BASIS_SSL_CHECK
    task_parameters :
      - { 'TASKNAME': 'CL_STCT_CHECK_SEC_CRYPTO', 'FIELDNAME': 'P_OPT2', 'VALUE': 'X' }
      - TASKNAME: CL_STCT_CHECK_SEC_CRYPTO
        FIELDNAME: P_OPT3
        VALUE: X
    task_settings: batch

# Exported environement variables.
- name: Hint if module will fail with error message like ImportError libsapnwrfc.so...
  community.general.sap_task_list_execute:
    conn_username: DDIC
    conn_password: Passwd1234
    host: 10.1.8.10
    sysnr: '00'
    client: '000'
    task_to_execute: SAP_BASIS_SSL_CHECK
    task_settings: batch
  environment:
    SAPNWRFC_HOME: /usr/local/sap/nwrfcsdk
    LD_LIBRARY_PATH: /usr/local/sap/nwrfcsdk/lib

Return Values

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

Key

Description

msg

string

A small execution description.

Returned: always

Sample: “Successful”

out

list / elements=dictionary

A complete description of the executed tasks. If this is available.

Returned: on success

Sample: [“…”, {“LOG”: {“STCTM_S_LOG”: [{“ACTIVITY”: “U_CONFIG”, “ACTIVITY_DESCR”: “Configuration changed”, “DETAILS”: null, “EXEC_ID”: “20210728184903.815739”, “FIELD”: null, “ID”: “STC_TASK”, “LOG_MSG_NO”: “000000”, “LOG_NO”: null, “MESSAGE”: “For radiobutton group ICM too many options are set; choose only one option”, “MESSAGE_V1”: “ICM”, “MESSAGE_V2”: null, “MESSAGE_V3”: null, “MESSAGE_V4”: null, “NUMBER”: “048”, “PARAMETER”: null, “PERIOD”: “M”, “PERIOD_DESCR”: “Maintenance”, “ROW”: “0”, “SRC_LINE”: “170”, “SRC_OBJECT”: “CL_STCTM_REPORT_UI IF_STCTM_UI_TASK~SET_PARAMETERS”, “SYSTEM”: null, “TIMESTMP”: “20210728184903”, “TSTPNM”: “DDIC”, “TYPE”: “E”}, “…”]}}]

Authors

  • Rainer Leber (@rainerleber)