Python script to reconfigure an ESXi for HA

1 minute read

If you have following my blog for some time you may remember a post from 2011 where I wrote about the procedure perform a Reconfigure for HA operation in an ESXi host from PowerCLI command line, I even published a small and dirty script to do it in one command. I’ve been thinking for some time to convert to Python that and many other vSphere scripts I have in PowerCLI and Perl and finally I decide to do it and this is the first result.

The usage of the script is very simple and follow the guidelines used in other pyVmomi scripts. you need to provide the vCenter Server, user with administrative rights and of course the ESXi host.

./reconfigure_host_for_ha.py -s vcsa-01.jreypo.io -u administrator@starlabs.local -e vsan-esx-01.jreypo.io

I’ve found an issue with the verification of vCenter SSL certificate and SmartConnect(), described in this pyVmomi issue and in the same issue I found the workaround provided by another user.

Grab the code from the below gist.

I’ve created a new repository on Github called pvymomi-scripts where I’ll be publishing more of my old scripts as soon as I code them in Python. Also, at least for this one, I have opened a pull request to pyVmomi Community Samples repository to get it included.

– Juanma

Comments