Skip to content
Jun 30 / Greg

Windows Updates With Snapshots Using Ansible Automation Platform

I was recently asking my teammate Jimmy(who’s brilliant BTW) what he shows as a compelling demo with Ansible and Windows, and he he had a more complicated version of what I’m about to show(most of his stuff is over the top(with Stallone)).

Video Demo

Playbook

Playbooks for Windows found here.

In this simple demo I’ll connect to my VMWare Vcenter and perform a snapshot with memory.
I have a next step of putting the system in maintenance mode in monitoring to stop notifications.
I’ll then perform a simple Windows update in a Windows server using WinRM. I do this from inside of a block. I do this because a block has some special functionality as in “rescue” and “always”.
I use a rescue block which is called if anything inside of the block fails. So, if my Windows host fails to update for any reason, it will call this rescue block which will rollback the snapshot to undue any potential damage caused.
My following step is to delete the snapshot(at this point I’m done with it). Take note that since I did a memory snapshot also, the machine will cleanly keep running. If you fail to add the memory option and restore the VM will restore in a stopped state.
The last step would be to remove the host from maintenance mode.

Conclusion

This isn’t something that’s relegated to just updates. Any potentially failure inducing operation could be protected against using this. This simple method could be used to protect anything, often even appliances could take advantage.

Let me know if you have any questions or comments.
Thanks and happy automating.

Leave a Comment

 

*