community.general.sap_task_list_execute (6.6.8) — module

Perform SAP Task list execution

| "added in version" 3.5.0 of community.general"

Authors: Rainer Leber (@rainerleber)

Install collection

Install with ansible-galaxy collection install community.general:==6.6.8


Add to requirements.yml

  collections:
    - name: community.general
      version: 6.6.8

Description

The C(sap_task_list_execute) module depends on C(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 C(STC_TM_API).


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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

Inputs

    
host:
    description: The required host for the SAP system. Can be either an FQDN or IP Address.
    required: true
    type: str

sysnr:
    default: '00'
    description:
    - The system number of the SAP system.
    - You must quote the value to ensure retaining the leading zeros.
    type: str

client:
    default: '000'
    description:
    - The client number to connect to.
    - You must quote the value to ensure retaining the leading zeros.
    type: str

task_skip:
    default: false
    description:
    - If this parameter is C(true) not defined tasks in I(task_parameters) are skipped.
    - This could be the case when only certain tasks should run from the task list.
    type: bool

conn_password:
    description: The required password for the SAP system.
    required: true
    type: str

conn_username:
    description: The required username for the SAP system.
    required: true
    type: str

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

task_parameters:
    description:
    - 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 I(task_skip=true).
    elements: dict
    suboptions:
      FIELDNAME:
        description: The name of the field of the task.
        type: str
      TASKNAME:
        description: The name of the task in the task list.
        required: true
        type: str
      VALUE:
        description: The value which have to be set.
        type: raw
    type: list

task_to_execute:
    description: The task list which will be executed.
    required: true
    type: str

Outputs

msg:
  description: A small execution description.
  returned: always
  sample: Successful
  type: str
out:
  description: A complete description of the executed tasks. If this is available.
  elements: dict
  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
      - '...'
  type: list