Removed notification
This commit is contained in:
@@ -17,33 +17,4 @@
|
|||||||
- name: Wait for systems to become reachable
|
- name: Wait for systems to become reachable
|
||||||
wait_for_connection:
|
wait_for_connection:
|
||||||
delay: 5
|
delay: 5
|
||||||
timeout: 300
|
timeout: 300
|
||||||
|
|
||||||
- name: Add server to rebooted_servers list
|
|
||||||
set_fact:
|
|
||||||
rebooted_servers: "{{ ansible_hostname }}"
|
|
||||||
when: reboot.stat.exists
|
|
||||||
|
|
||||||
- name: Gather rebooted_servers list
|
|
||||||
set_fact:
|
|
||||||
rebooted_servers_all: "{{ hostvars|selectattr('rebooted_servers', 'defined')|map(attribute='rebooted_servers')|list }}"
|
|
||||||
run_once: true
|
|
||||||
|
|
||||||
- name: Debug rebooted servers
|
|
||||||
debug:
|
|
||||||
var: rebooted_servers_all
|
|
||||||
|
|
||||||
- name: Send Teams notification
|
|
||||||
run_once: true
|
|
||||||
uri:
|
|
||||||
url: "{{ Teams_webhook }}"
|
|
||||||
method: POST
|
|
||||||
body: |
|
|
||||||
{
|
|
||||||
"title": "Playbook: {{ ansible_play_name }}",
|
|
||||||
"text": "The following servers were rebooted: {{ rebooted_servers_all | join(', ') }}"
|
|
||||||
}
|
|
||||||
body_format: json
|
|
||||||
headers:
|
|
||||||
Content-Type: application/json
|
|
||||||
when: rebooted_servers | length != 0
|
|
||||||
Reference in New Issue
Block a user