mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-03-20 03:57:02 +08:00
42 lines
1.3 KiB
YAML
42 lines
1.3 KiB
YAML
---
|
|
# Zabbix Maintenance Window Playbook
|
|
# Usage:
|
|
# ansible-playbook zabbix_maintenance.yml -e "state=present"
|
|
# ansible-playbook zabbix_maintenance.yml -e "state=absent"
|
|
|
|
- name: Manage Zabbix maintenance window
|
|
hosts: zabbix_stg:zabbix
|
|
gather_facts: false
|
|
|
|
vars_files:
|
|
- /srv/web/infra/ansible/vars/global.yml
|
|
- "/srv/private/ansible/vars.yml"
|
|
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
|
|
|
vars:
|
|
ansible_zabbix_auth_key: "{{ zabbix_auth_key }}"
|
|
ansible_network_os: "{{ zabbix_network_os }}"
|
|
ansible_connection: "{{ zabbix_connection }}"
|
|
ansible_httpapi_port: "{{ zabbix_httpapi_port }}"
|
|
ansible_httpapi_use_ssl: "{{ zabbix_httpapi_use_ssl }}"
|
|
ansible_httpapi_validate_certs: "{{ zabbix_httpapi_validate_certs }}"
|
|
ansible_host: "{{ zabbix_server }}"
|
|
ansible_zabbix_url_path: "{{ zabbix_url_path }}"
|
|
|
|
state: "present" # present or absent
|
|
maintenance_name: Manual shush window
|
|
|
|
# Choose ONE of these target methods:
|
|
# Option 1: Target hostgroups
|
|
target_hostgroups:
|
|
- "All servers"
|
|
|
|
tasks:
|
|
- name: Create/remove maintenance window
|
|
community.zabbix.zabbix_maintenance:
|
|
name: "{{ maintenance_name }}"
|
|
host_groups: "{{ target_hostgroups }}"
|
|
state: "{{ state }}"
|
|
minutes: 1440
|
|
collect_data: true
|