Write entries to Windows event logs via Ansible
I created playbook to reboot servers and add special log to event viewer.
I used for this module called community.windows.win_eventlog_entry
More info here >> https://docs.ansible.com/ansible/latest/collections/community/windows/win_eventlog_entry_module.html
Before use this module you need to install ansible-galaxy collection install community.windows.
Let’s start
Download >> WindowsLog
- Playbook looks like below and you can add some custom massage to easily notify what happened with server.
2. Lets test it. I run Playbook by type command ansible-playbook ansible/WindowsLog.yml
3. I notice my 2 servers was rebooted
4. I will login and check event viewer for some custom logs.
5. So you can add some custom Events before patching or some changes. It is very simple but can be really helpful from troubleshooting perspective.
Please Comment and Subscribe