community.sap_libs.sap_control_exec module – Ansible Module to execute SAPCONTROL

Note

This module is part of the community.sap_libs collection (version 1.6.0).

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.sap_libs.

To use it in a playbook, specify: community.sap_libs.sap_control_exec.

New in community.sap_libs 1.1.0

Synopsis

  • Provides support for sapstartsrv formaly known as sapcontrol

  • A complete information of all functions and the parameters can be found here https://www.sap.com/documents/2016/09/0a40e60d-8b7c-0010-82c7-eda71af511fa.html

  • When hostname is ‘localhost’, sysnr is set and no username/password are provided, the module will attempt to use local Unix socket authentication (which works with ‘become’ privilege escalation).

Aliases: sapcontrol

Parameters

Parameter

Comments

force

boolean

Forces the execution of the function Stop.

Choices:

  • false ← (default)

  • true

function

string / required

The function to execute.

Choices:

  • "Start"

  • "Stop"

  • "Shutdown"

  • "InstanceStart"

  • "InstanceStop"

  • "Bootstrap"

  • "ParameterValue"

  • "GetProcessList"

  • "GetProcessList2"

  • "GetStartProfile"

  • "GetTraceFile"

  • "GetAlertTree"

  • "GetAlerts"

  • "RestartService"

  • "StopService"

  • "GetEnvironment"

  • "ListDeveloperTraces"

  • "ListLogFiles"

  • "ReadDeveloperTrace"

  • "ReadLogFile"

  • "AnalyseLogFile"

  • "ConfigureLogFileList"

  • "GetLogFileList"

  • "RestartInstance"

  • "SendSignal"

  • "GetVersionInfo"

  • "GetQueueStatistic"

  • "GetInstanceProperties"

  • "OSExecute"

  • "AnalyseLogFiles"

  • "GetAccessPointList"

  • "GetSystemInstanceList"

  • "StartSystem"

  • "StopSystem"

  • "RestartSystem"

  • "AccessCheck"

  • "GetProcessParameter"

  • "SetProcessParameter"

  • "SetProcessParameter2"

  • "ShmDetach"

  • "CreateSnapshot"

  • "ReadSnapshot"

  • "ListSnapshots"

  • "DeleteSnapshots"

  • "RequestLogonFile"

  • "GetNetworkId"

  • "GetSecNetworkId"

  • "UpdateSystem"

  • "GetSystemUpdateList"

  • "UpdateSCSInstance"

  • "ABAPReadSyslog"

  • "ABAPReadRawSyslog"

  • "ABAPGetWPTable"

  • "ABAPAcknoledgeAlerts"

  • "CMGetThreadList"

  • "ICMGetConnectionList"

  • "ICMGetCacheEntries"

  • "ICMGetProxyConnectionList"

  • "WebDispGetServerList"

  • "WebDispGetGroupList"

  • "WebDispGetVirtHostList"

  • "WebDispGeUrlPrefixList"

  • "EnqGetLockTable"

  • "EnqRemoveLocks"

  • "EnqGetStatistic"

hostname

string

The hostname to connect to the sapstartsrv.

Could be an IP address, FQDN or hostname.

Default: "localhost"

parameter

string

The parameter to pass to the function.

password

string

The password to connect to the sapstartsrv.

port

integer

The port number of the sapstartsrv.

If provided, the module will use always use http connection instead of local socket.

sysnr

string

The system number of the instance.

username

string

The username to connect to the sapstartsrv.

Notes

Note

  • Does not support check_mode.

Examples

- name: GetProcessList with sysnr
  community.sap_libs.sap_control_exec:
    hostname: 192.168.8.15
    sysnr: "01"
    function: GetProcessList

- name: GetProcessList with custom port
  community.sap_libs.sap_control_exec:
    hostname: 192.168.8.15
    function: GetProcessList
    port: 50113

- name: ParameterValue with authentication
  community.sap_libs.sap_control_exec:
    hostname: 192.168.8.15
    sysnr: "01"
    username: hdbadm
    password: test1234
    function: ParameterValue
    parameter: ztta

- name: GetVersionInfo using local Unix socket (requires become)
  community.sap_libs.sap_control_exec:
    sysnr: "00"
    function: GetVersionInfo
  become: true

- name: GetProcessList using local Unix socket as SAP admin user
  community.sap_libs.sap_control_exec:
    sysnr: "00"
    function: GetProcessList
  become: true
  become_user: "{{ sap_sid | lower }}adm"

Return Values

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

Key

Description

msg

string

Success-message with functionname.

Returned: always

Sample: "Succesful execution of: GetProcessList"

out

list / elements=dictionary

The full output of the required function.

Returned: always

Sample: [{"item": [{"description": "MessageServer", "dispstatus": "SAPControl-GREEN", "elapsedtime": "412:30:50", "name": "msg_server", "pid": 70643, "starttime": "2022 03 13 15:22:42", "textstatus": "Running"}, {"description": "EnqueueServer", "dispstatus": "SAPControl-GREEN", "elapsedtime": "412:30:50", "name": "enserver", "pid": 70644, "starttime": "2022 03 13 15:22:42", "textstatus": "Running"}, {"description": "Gateway", "dispstatus": "SAPControl-GREEN", "elapsedtime": "412:30:50", "name": "gwrd", "pid": 70645, "starttime": "2022 03 13 15:22:42", "textstatus": "Running"}]}]

Authors

  • Rainer Leber (@RainerLeber)

  • Robert Kraemer (@rkpobe)