From 9c02e05ba0afbce8d804d200267676afa7eb7729 Mon Sep 17 00:00:00 2001 From: Danny de Kooker Date: Sat, 8 Jun 2024 14:23:25 +0200 Subject: [PATCH] added teams notification --- Maintenance/maint-reboot-required.yaml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Maintenance/maint-reboot-required.yaml b/Maintenance/maint-reboot-required.yaml index 93e47e0..88519ca 100644 --- a/Maintenance/maint-reboot-required.yaml +++ b/Maintenance/maint-reboot-required.yaml @@ -21,4 +21,18 @@ when: reboot.stat.exists - name: Wait for systems to become reachable - wait_for_connection: \ No newline at end of file + wait_for_connection: + + - name: Send Teams notification + uri: + url: "{{ Teams_webhook }}" + method: POST + body: | + { + "title": "Reboot Status", + "text": "Servers checked: {{ ansible_play_hosts_all | join(', ') }}{% if reboot.stat.exists %}. Rebooted: {{ ansible_play_hosts_all | join(', ') }}{% endif %}" + } + body_format: json + headers: + Content-Type: application/json + when: reboot.stat.exists or not reboot.stat.exists \ No newline at end of file