community.sap_libs.sap_task_list_execute 模块 – 执行 SAP 任务列表

注意

此模块是 community.sap_libs 集合 (版本 1.4.2) 的一部分。

如果您使用的是 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用: ansible-galaxy collection install community.sap_libs。您需要其他要求才能使用此模块,有关详细信息,请参阅 要求

要在 playbook 中使用它,请指定: community.sap_libs.sap_task_list_execute

community.sap_libs 0.1.0 中的新增功能

概要

  • community.sap_libs.sap_task_list_execute 模块依赖于 pyrfc Python 库(版本 2.4.0 及更高版本)。根据您使用的发行版,您可能需要安装其他软件包才能使用这些软件包。

  • 任务列表中需要手动操作的任务将自动确认。

  • 此模块将使用 RFC 包 STC_TM_API

要求

执行此模块的主机需要以下要求。

  • pyrfc >= 2.4.0

  • xmltodict

参数

参数

注释

client

字符串

要连接到的客户端编号。

必须引用该值以确保保留前导零。

默认值: "000"

conn_password

字符串 / 必需

SAP 系统所需的密码。

conn_username

字符串 / 必需

SAP 系统所需的用户名。

host

字符串 / 必需

SAP 系统所需的 host。可以是 FQDN 或 IP 地址。

sysnr

字符串

SAP 系统的系统编号。

必须引用该值以确保保留前导零。

默认值: "00"

task_parameters

列表 / 元素=字典

任务和执行参数。

如果任务列表不需要任何参数,则可以为空。

如果只需要执行任务列表中的特定任务,即使不需要参数,也必须与模块参数 *task_skip=true* 一起提供任务。

FIELDNAME

字符串

任务字段的名称。

TASKNAME

字符串 / 必需

任务列表中任务的名称。

VALUE

任意

必须设置的值。

task_settings

列表 / 元素=字符串

任务列表执行的设置。这可以是 TCODE SE80 中描述的以下内容:检查模式 CHECKRUN、后台处理活动 BATCH(这是默认值)、异步执行 ASYNC、跟踪模式 TRACE、服务器名称 BATCH_TARGET

默认值: ["BATCH"]

task_skip

布尔值

如果此参数为 true,则跳过 *task_parameters* 中未定义的任务。

当任务列表中只有某些任务应该运行时,可能会出现这种情况。

选项

  • false ← (默认)

  • true

task_to_execute

字符串 / 必需

将要执行的任务列表。

注释

注意

  • 不支持 check_mode。始终返回状态已更改。

示例

# Pass in a message
- name: Test task execution
  community.sap_libs.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.sap_libs.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 environment variables
- name: Hint if module will fail with error message like ImportError libsapnwrfc.so...
  community.sap_libs.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

返回值

此处记录了常见的返回值 此处,以下是此模块独有的字段

描述

msg

字符串

简短的执行描述。

返回:始终

示例: "Successful"

out

列表 / 元素=字典

已执行任务的完整描述。(如果可用)

返回:成功时

示例: ["...", {"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"}, "..."]}}]

作者

  • Rainer Leber (@rainerleber)