2
0

added consolidation on the notification

This commit is contained in:
2024-06-17 09:00:30 +02:00
parent 3b66befce0
commit b4b965259a

View File

@@ -25,13 +25,21 @@
results: >
{{ 'Reboot required on ' ~ inventory_hostname ~ ' with reboot status: ' ~ (reboot.stat.exists | ternary('True', 'False')) }}
- name: Consolidate results
set_fact:
consolidated_results: "{{ consolidated_results | default([]) + [results] }}"
run_once: true
delegate_to: localhost
- name: Send notification to Teams
uri:
url: "{{ Teams_webhook }}"
method: POST
body: |
{
"text": "{{ results }}"
"text": "{{ '\n'.join(consolidated_results) }}"
}
body_format: json
# when: reboot.stat.exists
run_once: true
delegate_to: localhost
when: consolidated_results | length > 0