One of the many benefits of having a home lab is you get to tinker and try new things. If you are like me and have had to start over from scratch, you are not alone.
I can’t tell you how many times I have had to re-deployed VMware vSphere and vCenter in my lab environment testing and something just went wrong.
Having to deploy vCenter with one or two hosts every once a while is not the big of a deal. If you have to re-deploy several times or deploy the same variables to many hosts, well that is a different story.
Last year during NetApp Insight, I attended a lecture given by David Blackwell on how to deploy a NetApp array with Ansible and my mind was blown. This opened my eyes to the endless possibilities of what you could do with automating and getting repeated results using Ansible.
I noticed David was using a Macbook Pro and he made mention that you could deploy Ansible and run it locally. Needless to say, I installed Ansible later that evening.
During the conference, I ran into my good friend Sean and conveyed how awesome the Ansible lecture was. Sean knew of Dave and had already been working on some Ansible Playbooks and pointed me to his blog. Make sure to check out his website for some amazing content. You can modify the properties of the playbooks to enhance and automate additional steps and that’s what I did during my installation. Check out Madlabber
VMware ISO /OVA Preperation
In my last blog post, I downloaded the VMware vCenter 7 VCSA ISO using my VMUG Advantage membership, so I don’t need to download it.
Before we can automate the deployment of vCenter with Ansible, we need to do some minor work by extracting the OVA file from the downloaded ISO image.
I have an Ansible directory for all the various technologies, this helps keep things tidy.
Mount the vCenter 7 vcsa
browse to the vcsa folder
copy the vcsa ova to your Ansible VMware directory
extract the vcsa ova to your Ansible VMware Directory and rename the ova to something shorter, I named mine vcsa7.ovf
Open and edit the Deploy-VCSA.yml, on my mac, I have already Install Xcode as you need this to edit your yaml files.
- notice the hostname, username, esxi variables, these will be located in the vcsa_vars.yml
- make sure to select the VM Network Interface
- make sure to set the validate cert to no, this is a lab and I am not concerned with certifications
Open and review the vCenter-properties.yml as these are the additional settings you can change.
- you can enable SSO
- you can deploy secondary vcenter and join existing SSO
- you can Join AD
Open and edit the vcsa-vars.yml file
Deploy VMware Ansible YAML
Launch Terminal and run the following command
- ~ansible-playbook Deploy-VCSA.yml
Go grab so coffee and monitor the Deployment of your vCenter VCSA 7, this usually takes roughly 20 minutes.
You have successfully deployed VMware vCenter 7 using Ansible.
Great post. Are you able to share your yaml files?
Yes… which ones are you looking for?
FYI – I am trying a nested vCenter deployment – deploying a vCenter instance into an existing vCenter and it didn’t appear to complete. Looking at the OVF file the issue seems to be that the guestinfo.cis.deployment.autoconfig property is defaulted to False and cannot be set by the User.
This forces you to connect to port 5480 and manually perform Stage 2 of the deployment.
I would imagine that I can edit the OVF to make this property write-able and then rebuild the OVA with a modified manifest ( or no manifest )
Just to confirm. I had to modify a line in the OVF:
I then modified the SHA256 key in the *mf file for the ovf file.
I then rebuilt the OVA ( tar -cvf VMware-vCenter-Server-Appliance-7.0.3.00100-18778458_OVF10* ).
With that done I got a complete deployment into an existing vCenter
Is this play out on github some place? Looks cool would like to give it a try
Yes, let me get it posted and share it.
when using the playbook, I get the following error:
[WARNING]: Problem validating OVF import spec: Line 768: Invalid value ‘Network 1’ for element ‘Connection’.
Yes, you need to change the Network Adapter Name to match what your Management Network is..typically its ‘VM Network’