I’m trying to quiet Nagios alerts after a Windows update, but before reboot. I call the playbook like this:
ansible-playbook -l ws0 win_updatelyrisserversB.yml (with or without -u)
Here are the relevant parts of my playbook:
- hosts: all
gather_facts: false
tasks:
-
name: win update
win_updates:
category: [‘SecurityUpdates’,‘CriticalUpdates’,‘Updates’,‘Tools’,‘DefinitionUpdates’,‘UpdateRollups’]
register: reboot_hint
tags: -
update
-
hosts: all
gather_facts: false
sudo: yes
tasks:
- nagios: action=downtime minutes=5 author=“Dimitri Yioulos” service=host host={{item}}
with_items: “{{ play_hosts }}”
with_items: “{{ groups[‘lyris’] }}”
with_items:
- ws0
delegate_to: admin2
when: hostvars[item][‘reboot_hint’][‘reboot_required’]
when: [‘reboot_hint.reboot_required’]
tags:
- nagios_downtime
- nagios: action=downtime minutes=5 author=“Dimitri Yioulos” service=all host={{item}}
with_items: “{{ play_hosts }}”
with_items: “{{ groups[‘lyris’] }}”
with_items:
- ws0
delegate_to: admin2
when: hostvars[item][‘reboot_hint’][‘reboot_required’]
when: [‘reboot_hint.reboot_required’]
tags:
-
nagios_downtime
-
hosts: all
gather_facts: false
tasks:
- name: reboot server
raw: ‘cmd /c shutdown /r /t 0’
when: reboot_hint.reboot_required == true
tags: - reboot
The Nagios play fails like this:
TASK: [nagios action=downtime minutes=5 author=“Dimitri Yioulos” service=host host={{item}}] ***
fatal: [ws0 → admin2] => Authentication failure.
FATAL: all hosts have already failed – aborting
As you can see from the commented out parts of the Nagios play, I’ve tried several things (many not shown) to try and make this work, if even possible. Can anyone help?
Thanks.