avantra.core.sapsystem module – manage SAP systems in Avantra

Note

This module is part of the avantra.core collection (version 23.0.3).

To install it, use: ansible-galaxy collection install avantra.core.

To use it in a playbook, specify: avantra.core.sapsystem.

New in avantra.core 23.0.0

Synopsis

  • You can create, delete or update SAP systems in Avantra.

  • Start, stop, restart SAP systems using Avantra functionality.

  • A SAP system is always identified with its Unified SAP SID and customer name.

Note

This module has a corresponding action plugin.

Parameters

Parameter

Comments

application_type

string

The application type (one of the defined in the customizations).

avantra_api_password

string

The password or API key for the selected Avantra user.

We highly recommend to use Ansible Vaults to protect you sensitive content.

avantra_api_url

string / required

A valid URL pointing to an Avantra UI.

For example https://avantra-ui/xn

avantra_api_user

string

Valid Avantra user principal.

credentials

dictionary

Add credentials to this SAP system. See the examples for more information on how to set the different credential types. The key for the child objects is one of the credential keys found in Avantra.

We highly recommend to use Ansible Vaults to protect you sensitive content.

custom_attributes

dictionary

Define custom attributes for the monitored system as key value pairs. See https://docs.avantra.com/product-guide/latest/avantra/custom-attributes.html for an explanation.

Default: {}

customer_name

string / required

A customer name known by Avantra. Together with the unified_sap_sid parameter it identifies a SAP system.

database

dictionary

Configures the database detail for the SAP system.

host

string

Defines the database host.

monitoring_server_system_id

string

The system ID of the server monitoring the database.

name

string

Configures the database name.

port

string

Defines the database port.

description

string

The description for the SAP system.

exists_state

string

If present the SAP system with the given parameter is created in case is does not exist or modified in case it exists.

If absent the SAP system identified by the unified_sap_sid and customer_name is deleted if it exists.

Choices:

  • "present" ← (default)

  • "absent"

monitoring

boolean

Should the monitoring be turned on or off.

This applies only to exists_state=present.

For exists_state=absent this parameter will be ignored.

Choices:

  • false

  • true

notes

string

The notes for the SAP system.

real_sap_sid

string

The Real SAP SID of the SAP system. Maximum allowed length is 3 characters.

If exists_state=present and the SAP system has to be created this parameter is mandatory.

remote_monitoring_entry_point

string

Configures the remote entrypoint for agentless SAP system.

remote_monitoring_server_system_id

string

Configures the server monitoring the remote SAP system.

run_options

dictionary

Allows you to configure the behaviour of the run_state changes.

Default: {}

always_execute

boolean

Ignore the current state and just execute the start/stop/restart.

Choices:

  • false ← (default)

  • true

check_db_state

boolean

If with_database=true then the task checks the database state before starting SAP system (only for Linux, uses R3Trans).

Choices:

  • false

  • true ← (default)

execution_name

string

Defines a name for the action to be executed.

force_stop

boolean

Avantra checks for known running applications (ie. applications with monitoring turned on) and cancels a stop if some are found. With force_stop=true, the server will be stopped in any case.

Choices:

  • false

  • true ← (default)

monitoring

boolean

If run_state=started this parameter defaults to true.

If run_state=stopped this parameter defaults to false.

If run_state=restarted this parameter is ignored.

Choices:

  • false

  • true

restart_wait_seconds

integer

Defines the wait time in seconds after a stop before start process is started.

Default: 5

send_user_info

boolean

Send a message to all users logged in with SAPGUI. Use this option together with soft_timeout setting.

Choices:

  • false ← (default)

  • true

soft_timeout

integer

Defines the soft timeout a timeout in seconds for a soft shutdown via SIGQUIT, if the timeout expires a hard shutdown is used. After the soft timeout, logged in users are automatically logged out.

Default: 0

wait_seconds

integer

Defines the wait time in seconds after a server start before executing next steps.

Default: 60

with_database

boolean

Starts/Stops/Restarts the SAP System including the database.

Choices:

  • false ← (default)

  • true

with_servers

boolean

Starts/Stops/Restarts all cloud servers, the SAP database (full) and the SAP System.

If with_servers=true then with_database=true is needed as well and with_system_db_if_hana must not be true.

Choices:

  • false ← (default)

  • true

with_system_db_if_hana

boolean

Starts/Stops/Restarts the SAP HANA System DB, all HANA tenants and the SAP System.

If with_system_db_if_hana=true then with_database=true is needed as well and with_server must not be true.

Choices:

  • false ← (default)

  • true

run_state

string

If started and the current state is run_state=stopped or run_state=unknown the SAP system will be started.

If stopped and the current state is run_state=started or run_state=unknown the SAP system will be started.

If restarted the SAP system will be restarted.

Note: if exists_state=absent and the SAP system exists the run state change will be applied before the SAP system is deleted. If exists_state=present the run state change will be executed after the SAP system has been created.

Choices:

  • "started"

  • "stopped"

  • "restarted"

system_role

string

Configures the system role.

If exists_state=present and the system has to be created this parameter is mandatory.

By default the following roles are available: Consolidation, Development, Education, Integration, Production, Quality assurance, Sandpit, Test. The can be customized in Avantra.

timezone

string

Configures the timezone for the system.

token

string

The token used to authenticate during the task execution. A token can be fetched with the avantra.core.login module. If token is defined avantra_api_user and avantra_api_password are not necessary.

unified_sap_sid

string / required

The Unified SAP SID of a SAP system. Together with the customer_name parameter it identifies a SAP system.

Notes

Note

  • This module does NOT support check_mode.

  • We highly recommend to use Ansible Vaults to protect your sensitive content.

See Also

See also

Avantra Documentation

The official Avantra documentation.

Examples

- name: Delete SAP system from Avantra if it exists
  avantra.core.sapsystem:
    exists_state: absent
    unified_sap_sid: "UNF_SAP_SYS"
    customer_name: "mis"

- name: Create SAP system if it doesn't exist
  avantra.core.sapsystem:
    exists_state: present
    unified_sap_sid: "AVA_EXA"
    real_sap_sid: "EXA"
    customer_name: "Example Customer"
    system_role: "Development"
    timezone: "UTC"
    monitoring: true
    notes: "Some notes"
    description: "A description"
    database:
      monitoring_server_system_id: 253
      host: "golf"
      name: "EXA"
      port: 12345
    credentials:
      # SAP control user
      avantra.sapControl:
        cred_type: sap_control
        username: <user>
        password: <password>
      # ABAP user
      avantra.defaultRfcUser:
        cred_type: rfc
        username: <user>
        password: <password>
        client: 000
      # ABAP database user
      avantra.abapDbSchema:
        cred_type: basic
        username: <user>
        password: <password>
      # J2EE user
      avantra.j2eeUser:
        cred_type: basic
        username: <user>
        password: <password>
      # J2EE database user
      avantra.javaDbSchema:
        cred_type: basic
        username: <user>
        password: <password>

- name: Restart the SAP system
  avantra.core.sapsystem:
    exists_state: present
    run_state: restarted
    run_options:
      execution_name: "Restart the AVA_EXE SAP system"
    unified_sap_sid: "AVA_EXA"
    customer_name: Avantra

- name: Restart the SAP system with its database and servers
  avantra.core.sapsystem:
    exists_state: present
    run_state: restarted
    run_options:
      execution_name: "Restart the AVA_EXE SAP system with its database and servers"
      with_database: true
      with_servers: true
    unified_sap_sid: "AVA_EXA"
    customer_name: Avantra

Return Values

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

Key

Description

sap_system

dictionary

If exists_state=present and the SAP system can be identified the system information is returned.

Returned: present

Authors

  • Michael Szediwy (@avantra-mis)