1
0
Fork 0
forked from infra/ansible

Zabbix: Update host_reboot play to shush Zabbix

Signed-off-by: Greg Sutcliffe <fedora@emeraldreverie.org>
This commit is contained in:
Greg Sutcliffe 2025-11-18 14:45:36 +00:00 committed by gwmngilfen
commit b3b1947c21

View file

@ -7,16 +7,50 @@
user: root
serial: 1
# We need the Zabbix API key from private
vars_files:
- "/srv/private/ansible/vars.yml"
tasks:
- name: Tell nagios to shush
nagios: action=downtime minutes=60 service=host host={{ inventory_hostname_short }}{{ env_suffix }}
delegate_to: noc01.rdu3.fedoraproject.org
ignore_errors: true
- name: Disable target in Zabbix
community.zabbix.zabbix_host:
host_name: "{{ target }}"
status: disabled
vars:
# We can't put the zabbix vars in a block or it'll reboot the host running the play (i.e batcave)
# so we'll have to duplicate them below
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 }}"
- name: Reboot the host
reboot: reboot_timeout=1800
ansible.builtin.reboot:
reboot_timeout=1800
- name: Tell nagios to unshush
nagios: action=unsilence service=host host={{ inventory_hostname_short }}{{ env_suffix }}
delegate_to: noc01.rdu3.fedoraproject.org
ignore_errors: true
- name: Enable target in Zabbix
community.zabbix.zabbix_host:
host_name: "{{ target }}"
status: enabled
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 }}"