added consolidation on the notification
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user