diff --git a/playbooks/host_reboot.yml b/playbooks/host_reboot.yml index 5aaa0dcdd2..26df2eaa1f 100644 --- a/playbooks/host_reboot.yml +++ b/playbooks/host_reboot.yml @@ -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 }}"