jijojoy

Cadet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023
06:28 AM
- 1,544 Views
Windows Health check status
Hello Experts
bellow query to automate Windows server using ansible :
Needs to convert a task output as an aligned format such as Excel, HTML and etc, and send the same through a mail to the respective team
Eg: every day morning needs have system helth check (using PowerShell script ) and the status needs to send over the mail to the support team
expecting your suggesting , what filters we can use to fulfill above requirements
2 Replies
Tess

Flight Engineer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023
11:57 AM
- 1,527 Views
In my opinion, this is not something you would build using Ansible. You would only use Ansible to deploy the solution.
- You can make a Powershell script that does what you want it to.
- You can use the Windows scheduling service (compare it to cron on Linux) to run it.
- You can use Ansible to deploy it.

Community Manager
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023
05:48 PM
- 1,510 Views
Hi @jijojoy ,
Thanks for reaching out !
You need three modules to work on this :
1. win_shell : https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_shell_module.html to run a command / powershell command to get the desired output.
2. Format your output using "template" module or use this filter to convert the stdout to a table {{abc.stdout | table }}
3, use mail module to send a mail with that table attachment : https://docs.ansible.com/ansible/latest/collections/community/general/mail_module.html
Join the discussion
You must log in to join this conversation.