community.zabbix.zabbix_maintenance (1.8.0) — module

Create Zabbix maintenance windows

Authors: Alexander Bulimov (@abulimov)

Install collection

Install with ansible-galaxy collection install community.zabbix:==1.8.0


Add to requirements.yml

  collections:
    - name: community.zabbix
      version: 1.8.0

Description

This module will let you create Zabbix maintenance windows.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a named maintenance window for host www1 for 90 minutes
  community.zabbix.zabbix_maintenance:
    name: Update of www1
    host_name: www1.example.com
    state: present
    minutes: 90
    server_url: https://monitoring.example.com
    login_user: ansible
    login_password: pAsSwOrD
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a named maintenance window for host www1 and host groups Office and Dev
  community.zabbix.zabbix_maintenance:
    name: Update of www1
    host_name: www1.example.com
    host_groups:
      - Office
      - Dev
    state: present
    server_url: https://monitoring.example.com
    login_user: ansible
    login_password: pAsSwOrD
    tags:
      - tag: ExampleHostsTag
      - tag: ExampleHostsTag2
        value: ExampleTagValue
      - tag: ExampleHostsTag3
        value: ExampleTagValue
        operator: 0
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a named maintenance window for hosts www1 and db1, without data collection.
  community.zabbix.zabbix_maintenance:
    name: update
    host_names:
      - www1.example.com
      - db1.example.com
    state: present
    collect_data: False
    server_url: https://monitoring.example.com
    login_user: ansible
    login_password: pAsSwOrD
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove maintenance window by name
  community.zabbix.zabbix_maintenance:
    name: Test1
    state: absent
    server_url: https://monitoring.example.com
    login_user: ansible
    login_password: pAsSwOrD

Inputs

    
desc:
    default: Created by Ansible
    description:
    - Short description of maintenance window.
    type: str

name:
    description:
    - Unique name of maintenance window.
    required: true
    type: str

tags:
    description:
    - List of tags to assign to the hosts in maintenance.
    - Requires I(collect_data=yes).
    elements: dict
    suboptions:
      operator:
        default: 2
        description:
        - Condition operator.
        - Possible values is
        - 0 - Equals
        - 2 - Contains
        type: int
      tag:
        description:
        - Name of the tag.
        required: true
        type: str
      value:
        default: ''
        description:
        - Value of the tag.
        type: str
    type: list

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Create or remove a maintenance window. Maintenance window to remove is identified
      by name.
    type: str

minutes:
    default: 10
    description:
    - Length of maintenance window in minutes.
    type: int

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

host_names:
    aliases:
    - host_name
    description:
    - Hosts to manage maintenance window for.
    - B(Required) option when I(state=present) and I(host_groups) is not used.
    elements: str
    type: list

login_user:
    description:
    - Zabbix user name.
    - If not set the environment variable C(ZABBIX_USERNAME) will be used.
    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).
    - If not set the environment variable C(ZABBIX_SERVER) will be used.
    required: true
    type: str

host_groups:
    aliases:
    - host_group
    description:
    - Host groups to manage maintenance window for.
    - B(Required) option when I(state=present) and I(host_names) is not used.
    elements: str
    type: list

collect_data:
    default: 'yes'
    description:
    - Type of maintenance. With data collection, or without.
    type: bool

visible_name:
    default: 'yes'
    description:
    - Type of zabbix host name to use for identifying hosts to include in the maintenance.
    - I(visible_name=yes) to search by visible name,  I(visible_name=no) to search by
      technical name.
    type: bool
    version_added: 2.0.0
    version_added_collection: community.zabbix

login_password:
    description:
    - Zabbix user password.
    - If not set the environment variable C(ZABBIX_PASSWORD) will be used.
    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.
    - If not set the environment variable C(ZABBIX_VALIDATE_CERTS) will be used.
    type: bool

http_login_user:
    description:
    - Basic Auth login
    type: str

http_login_password:
    description:
    - Basic Auth password
    type: str