mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-02-02 12:49:00 +08:00
57 lines
2.0 KiB
YAML
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 }}"
|