community.sap_libs.sap_user module – This module will manage a user entities in a SAP S4/HANA environment
Note
This module is part of the community.sap_libs collection (version 1.5.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.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.sap_libs.sap_user.
New in community.sap_libs 1.0.0
Synopsis
- The community.sap_libs.sap_user module depends on - pyrfcPython library (version 2.4.0 and upwards). Depending on distribution you are using, you may need to install additional packages to have these available.
- This module will use the following user BAPIs to manage user entities. - - BAPI_USER_GET_DETAIL-- BAPI_USER_DELETE-- BAPI_USER_CREATE1-- BAPI_USER_CHANGE-- BAPI_USER_ACTGROUPS_ASSIGN-- BAPI_USER_PROFILES_ASSIGN-- BAPI_USER_UNLOCK-- BAPI_USER_LOCK
Requirements
The below requirements are needed on the host that executes this module.
- pyrfc >= 2.4.0 
Parameters
| Parameter | Comments | 
|---|---|
| The client number to connect to. You must quote the value to ensure retaining the leading zeros. Default:  | |
| The specific company the user belongs to. The company name must be available in the SAP system. | |
| The required password for the SAP system. | |
| The required username for the SAP system. | |
| The email address of the user in the SAP system. | |
| The Firstname of the user in the SAP system. | |
| Must be  Choices: 
 | |
| The required host for the SAP system. Can be either an FQDN or IP Address. | |
| The lastname of the user in the SAP system. | |
| The password for the user in the SAP system. | |
| Assign profiles to the user. Should be in uppercase, for example  Default:  | |
| Assign roles to the user. Default:  | |
| The decision what to do with the user. Choices: 
 | |
| The system number of the SAP system. You must quote the value to ensure retaining the leading zeros. Default:  | |
| The type for the user in the SAP system. 
 Must be in uppercase. Choices: 
 | |
| The alias for the user in the SAP system. | |
| The username. | 
Notes
Note
- Does not support - check_mode.
Examples
- name: Create SAP User
  community.sap_libs.sap_user:
    conn_username: 'DDIC'
    conn_password: 'Test123'
    host: 192.168.1.150
    sysnr: '01'
    client: '000'
    state: present
    username: ADMIN
    firstname: first_admin
    lastname: last_admin
    email: [email protected]
    password: Test123456
    useralias: ADMIN
    company: DEFAULT_COMPANY
    roles:
      - "SAP_ALL"
- name: Force change SAP User
  community.sap_libs.sap_user:
    conn_username: 'DDIC'
    conn_password: 'Test123'
    host: 192.168.1.150
    sysnr: '01'
    client: '000'
    state: present
    force: true
    username: ADMIN
    firstname: first_admin
    lastname: last_admin
    email: [email protected]
    password: Test123456
    useralias: ADMIN
    company: DEFAULT_COMPANY
    roles:
      - "SAP_ALL"
- name: Delete SAP User
  community.sap_libs.sap_user:
    conn_username: 'DDIC'
    conn_password: 'Test123'
    host: 192.168.1.150
    sysnr: '01'
    client: '000'
    state: absent
    force: true
    username: ADMIN
- name: Unlock SAP User
  community.sap_libs.sap_user:
    conn_username: 'DDIC'
    conn_password: 'Test123'
    host: 192.168.1.150
    sysnr: '01'
    client: '000'
    state: unlock
    force: true
    username: ADMIN
Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Description | 
|---|---|
| A small execution description about the user action. Returned: always Sample:  | |
| A detailed description about the user action. Returned: on success Sample:  | 
