community.general.zabbix_group (0.1.1) — module

Create/delete Zabbix host groups

Authors: Cove (@cove), Tony Minfei Ding (!UNKNOWN), Harrison Gu (@harrisongu)

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

Create host groups if they do not exist.

Delete existing host groups if they exist.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Base create host groups example
- name: Create host groups
  local_action:
    module: zabbix_group
    server_url: http://monitor.example.com
    login_user: username
    login_password: password
    state: present
    host_groups:
      - Example group1
      - Example group2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Limit the Zabbix group creations to one host since Zabbix can return an error when doing concurrent updates
- name: Create host groups
  local_action:
    module: zabbix_group
    server_url: http://monitor.example.com
    login_user: username
    login_password: password
    state: present
    host_groups:
      - Example group1
      - Example group2
  when: inventory_hostname==groups['group_name'][0]

Inputs

    
state:
    choices:
    - present
    - absent
    default: present
    description:
    - Create or delete host group.
    required: false
    type: str

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

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

host_groups:
    aliases:
    - host_group
    description:
    - List of host groups to create or delete.
    elements: str
    required: true
    type: list

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

http_login_user:
    description:
    - Basic Auth login
    type: str

http_login_password:
    description:
    - Basic Auth password
    type: str