Ansible for VMware
Most of the Ansible stuff I see out there online is for deploying developer VM instances into existing VMware infrastructure, but we need to use it to manage the VMware infrastructure. For example, the Dynamic Inventory script only returns the Virtual Machines, not the hosts, does this push me into maintaining hostnames manually? We have over 1000 ESXi hosts and we need configuration management to make our lives better. Adding and removing are not as smooth as they should be if we had better automation. It is my goal to get us further along this road, first things first we need to capture the exiting configurations as code.
I’m still learning as I go but I’ve gotten the basic fact gathering module working and I performed a host config change as seamlessly as you’d hope. The next step is going to be a lot more time consuming, capturing the environment as code task by task. Sure, it is easy to enable HA but there are several advanced HA settings that also need to be set, if those settings are not handled by the existing module we’ll have to write them. This bring us to the gap analysis we’re doing, if we get close enough with exiting code then the cost to write the new code will be less than the cost to bash this all out in PowerCLI.
PowerCLI gives me a bit more confidence that we could control for mistakes with Pester Tests, Ansible seems perfectly fine for configuring brand new hardware with nothing to lose but I’m less confident (likely due to my lack of experience) that Ansible won’t screw us over. Sure, that is why we test it. I started writing a custom module following this post, so far so good. I am speculating that we will want a custom module for VMC, I hope to be able to stamp out new environments on demand. The VMC automation get us so far but there are always specific tasks that we need to do, but they should not be manual – Automate All theThings.