test
This commit is contained in:
@@ -22,6 +22,14 @@
|
||||
|
||||
- name: Wait for systems to become reachable
|
||||
wait_for_connection:
|
||||
|
||||
- name: Gather server information
|
||||
set_fact:
|
||||
server_info: "{{ { 'server': inventory_hostname, 'rebooted': reboot.stat.exists } }}"
|
||||
|
||||
- name: Create a list of server information
|
||||
set_fact:
|
||||
server_list: "{{ server_list | default([]) + [server_info] }}"
|
||||
|
||||
- name: Send Teams notification
|
||||
run_once: true
|
||||
@@ -32,13 +40,21 @@
|
||||
{
|
||||
"title": "Playbook: {{ ansible_play_name }}",
|
||||
"text": "All servers were checked and rebooted where needed.",
|
||||
"facts": [
|
||||
{% for host in ansible_play_hosts_all %}
|
||||
"sections": [
|
||||
{
|
||||
"name": "{{ host }}",
|
||||
"value": "{% if hostvars[host]['reboot'] is defined and hostvars[host]['reboot'].stat.exists %}&#U+2705 Rebooted{% else %}Not Rebooted{% endif %}"
|
||||
}{% if not loop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
"activityTitle": "Server Reboot Status",
|
||||
"facts": [
|
||||
{
|
||||
"name": "Server",
|
||||
"value": "{{ server_list | map(attribute='server') | join(', ') }}"
|
||||
},
|
||||
{
|
||||
"name": "Rebooted",
|
||||
"value": "{{ server_list | map(attribute='rebooted') | map('string') | join(', ') }}"
|
||||
}
|
||||
],
|
||||
"markdown": true
|
||||
}
|
||||
]
|
||||
}
|
||||
body_format: json
|
||||
|
||||
Reference in New Issue
Block a user