community.sap.sap_user (1.0.0) — module

This module will manage a user entities in a SAP S4/HANA environment

| "added in version" 1.0.0 of community.sap"

Authors: Rainer Leber (@rainerleber)

Install collection

Install with ansible-galaxy collection install community.sap:==1.0.0


Add to requirements.yml

  collections:
    - name: community.sap
      version: 1.0.0

Description

The M(community.sap.sap_user) 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.

This module will use the following user BAPIs to manage user entities. - C(BAPI_USER_GET_DETAIL) - C(BAPI_USER_DELETE) - C(BAPI_USER_CREATE1) - C(BAPI_USER_CHANGE) - C(BAPI_USER_ACTGROUPS_ASSIGN) - C(BAPI_USER_PROFILES_ASSIGN) - C(BAPI_USER_UNLOCK) - C(BAPI_USER_LOCK)


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create SAP User
  community.sap.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: admin@test.de
    password: Test123456
    useralias: ADMIN
    company: DEFAULT_COMPANY
    roles:
      - "SAP_ALL"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Force change SAP User
  community.sap.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: admin@test.de
    password: Test123456
    useralias: ADMIN
    company: DEFAULT_COMPANY
    roles:
      - "SAP_ALL"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete SAP User
  community.sap.sap_user:
    conn_username: 'DDIC'
    conn_password: 'Test123'
    host: 192.168.1.150
    sysnr: '01'
    client: '000'
    state: absent
    force: true
    username: ADMIN
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Unlock SAP User
  community.sap.sap_user:
    conn_username: 'DDIC'
    conn_password: 'Test123'
    host: 192.168.1.150
    sysnr: '01'
    client: '000'
    state: unlock
    force: true
    username: ADMIN

Inputs

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

email:
    description:
    - The email address of the user in the SAP system.
    required: false
    type: str

force:
    default: false
    description:
    - Must be C('True') if the password or type should be overwritten.
    required: false
    type: bool

roles:
    default:
    - ''
    description:
    - Assign roles to the user.
    elements: str
    required: false
    type: list

state:
    choices:
    - present
    - absent
    - lock
    - unlock
    default: present
    description:
    - The decision what to do with the user.
    required: false
    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

company:
    description:
    - The specific company the user belongs to.
    - The company name must be available in the SAP system.
    required: false
    type: str

lastname:
    description:
    - The lastname of the user in the SAP system.
    required: false
    type: str

password:
    description:
    - The password for the user in the SAP system.
    required: false
    type: str

profiles:
    default:
    - ''
    description:
    - Assign profiles to the user.
    - Should be in uppercase, for example C('SAP_NEW') or C('SAP_ALL').
    elements: str
    required: false
    type: list

username:
    description:
    - The username.
    required: true
    type: str

firstname:
    description:
    - The Firstname of the user in the SAP system.
    required: false
    type: str

user_type:
    choices:
    - A
    - B
    - C
    - S
    - L
    default: A
    description:
    - The type for the user in the SAP system.
    - C('A') Dialog user, C('B') System User, C('C') Communication User, C('S') Service
      User, C('L') Reference User.
    - Must be in uppercase.
    required: false
    type: str

useralias:
    description:
    - The alias for the user in the SAP system.
    required: false
    type: str

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

Outputs

msg:
  description: A small execution description about the user action.
  returned: always
  sample: User ADMIN created
  type: str
out:
  description: A detailed description about the user action.
  elements: dict
  returned: on success
  sample:
  - '...'
  - RETURN:
    - FIELD: BNAME
      ID: '01'
      LOG_MSG_NO: '000000'
      LOG_NO: ''
      MESSAGE: User ADMIN created
      MESSAGE_V1: ADMIN
      MESSAGE_V2: ''
      MESSAGE_V3: ''
      MESSAGE_V4: ''
      NUMBER: '102'
      PARAMETER: ''
      ROW: 0
      SYSTEM: ''
      TYPE: S
    SAPUSER_UUID_HIST: []
  type: list