Files
fedora-infra_ansible/playbooks/host_reboot.yml
Greg Sutcliffe b3b1947c21 Zabbix: Update host_reboot play to shush Zabbix
Signed-off-by: Greg Sutcliffe <fedora@emeraldreverie.org>
2025-12-19 13:15:01 +00:00

57 lines
2.0 KiB
YAML

# requires --extra-vars="target=hostspec"
---
- name: Reboot hosts
hosts: "{{ target }}"
gather_facts: false
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
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 }}"