community.general.zabbix_user (0.1.1) — module

Create/update/delete Zabbix users

Authors: sky-joker (@sky-joker)

preview | supported by community

Install collection

Install with ansible-galaxy collection install community.general:==0.1.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

Description

This module allows you to create, modify and delete Zabbix users.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: create of zabbix user.
  zabbix_user:
    server_url: "http://zabbix.example.com/zabbix/"
    login_user: Admin
    login_password: secret
    alias: example
    name: user name
    surname: user surname
    usrgrps:
      - Guests
      - Disabled
    passwd: password
    lang: en_GB
    theme: blue-theme
    autologin: no
    autologout: '0'
    refresh: '30'
    rows_per_page: '200'
    after_login_url: ''
    user_medias:
      - mediatype: Email
        sendto: example@example.com
        period: 1-7,00:00-24:00
        severity:
          not_classified: no
          information: yes
          warning: yes
          average: yes
          high: yes
          disaster: yes
        active: no
    type: Zabbix super admin
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: delete of zabbix user.
  zabbix_user:
    server_url: "http://zabbix.example.com/zabbix/"
    login_user: admin
    login_password: secret
    alias: example
    usrgrps:
      - Guests
    passwd: password
    user_medias:
      - sendto: example@example.com
    state: absent

Inputs

    
lang:
    choices:
    - en_GB
    - en_US
    - zh_CN
    - cs_CZ
    - fr_FR
    - he_IL
    - it_IT
    - ko_KR
    - ja_JP
    - nb_NO
    - pl_PL
    - pt_BR
    - pt_PT
    - ru_RU
    - sk_SK
    - tr_TR
    - uk_UA
    default: en_GB
    description:
    - Language code of the user's language.
    type: str

name:
    default: ''
    description:
    - Name of the user.
    type: str

type:
    choices:
    - Zabbix user
    - Zabbix admin
    - Zabbix super admin
    default: Zabbix user
    description:
    - Type of the user.
    type: str

alias:
    description:
    - Name of the user alias in Zabbix.
    - alias is the unique identifier used and cannot be updated using this module.
    required: true
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the user.
    - On C(present), it will create if user does not exist or update the user if the associated
      data is different.
    - On C(absent) will remove a user if it exists.
    type: str

theme:
    choices:
    - default
    - blue-theme
    - dark-theme
    default: default
    description:
    - User's theme.
    type: str

passwd:
    description:
    - User's password.
    required: true
    type: str

refresh:
    default: '30'
    description:
    - Automatic refresh period in seconds.
    type: str

surname:
    default: ''
    description:
    - Surname of the user.
    type: str

timeout:
    default: 10
    description:
    - The timeout of API request (seconds).
    type: int

usrgrps:
    description:
    - User groups to add the user to.
    elements: str
    required: true
    type: list

autologin:
    default: false
    description:
    - Whether to enable auto-login.
    - If enable autologin, cannot enable autologout.
    type: bool

autologout:
    default: '0'
    description:
    - User session life time in seconds. If set to 0, the session will never expire.
    - If enable autologout, cannot enable autologin.
    type: str

login_user:
    description:
    - Zabbix user name.
    required: true
    type: str

server_url:
    aliases:
    - url
    description:
    - URL of Zabbix server, with protocol (http or https). C(url) is an alias for C(server_url).
    required: true
    type: str

user_medias:
    default: []
    description:
    - Set the user's media.
    elements: dict
    suboptions:
      active:
        default: true
        description:
        - Whether the media is enabled.
        type: bool
      mediatype:
        default: Email
        description:
        - Media type name to set.
        type: str
      period:
        default: 1-7,00:00-24:00
        description:
        - Time when the notifications can be sent as a time period or user macros separated
          by a semicolon.
        - Please review the documentation for more information on the supported time period.
        - https://www.zabbix.com/documentation/4.0/manual/appendix/time_period
        type: str
      sendto:
        description:
        - Address, user name or other identifier of the recipient.
        required: true
        type: str
      severity:
        default:
          average: true
          disaster: true
          high: true
          information: true
          not_classified: true
          warning: true
        description:
        - Trigger severities to send notifications about.
        suboptions:
          average:
            default: true
            description:
            - severity average enable/disable.
            type: bool
          disaster:
            default: true
            description:
            - severity disaster enable/disable.
            type: bool
          high:
            default: true
            description:
            - severity high enable/disable.
            type: bool
          information:
            default: true
            description:
            - severity information enable/disable.
            type: bool
          not_classified:
            default: true
            description:
            - severity not_classified enable/disable.
            type: bool
          warning:
            default: true
            description:
            - severity warning enable/disable.
            type: bool
        type: dict
    type: list

rows_per_page:
    default: '50'
    description:
    - Amount of object rows to show per page.
    type: str

login_password:
    description:
    - Zabbix user password.
    required: true
    type: str

validate_certs:
    default: true
    description:
    - If set to False, SSL certificates will not be validated. This should only be used
      on personally controlled sites using self-signed certificates.
    type: bool

after_login_url:
    default: ''
    description:
    - URL of the page to redirect the user to after logging in.
    type: str

http_login_user:
    description:
    - Basic Auth login
    type: str

override_passwd:
    default: false
    description:
    - Override password.
    type: bool

http_login_password:
    description:
    - Basic Auth password
    type: str

Outputs

user_ids:
  description: User id created or changed
  returned: success
  sample:
    userids:
    - '5'
  type: dict