forked from infra/ansible
Zabbix: add shush/ok scripts and playbook
Signed-off-by: Greg Sutcliffe <fedora@emeraldreverie.org>
This commit is contained in:
parent
edf4cf6030
commit
0e0b5f92c6
3 changed files with 47 additions and 0 deletions
41
playbooks/zabbix_maintenance.yml
Normal file
41
playbooks/zabbix_maintenance.yml
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
# 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
|
||||
3
scripts/zabbix-ok
Executable file
3
scripts/zabbix-ok
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
ansible-playbook /srv/web/infra/ansible/playbooks/zabbix_maintenance.yml -e "state=absent"
|
||||
3
scripts/zabbix-shush
Executable file
3
scripts/zabbix-shush
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
ansible-playbook /srv/web/infra/ansible/playbooks/zabbix_maintenance.yml
|
||||
Loading…
Add table
Add a link
Reference in a new issue