In this guide I will walk you through configuring the vSphere Jenkins Plugin to deploy VM’s to VMware Cloud on AWS SDDC. This way you can run your CI/CD Pipelines in the cloud and on-prem.
Pre-Reqs
- A working installation of Jenkins that has network connectivity to the VMware Cloud on AWS vCenter
- A Service Account that has access to create and clone VM’s in the VMware Cloud on AWS vCenter see full list of rights needed here
- A working template that you can successfully clone to new VM with guest customization script in vCenter
- A quiet place where you will not be interrupted see my guide here
Take a snapshot of the template
Right click on the template, then click Snapshots, then Take Snapshot
Install the vSphere Plugin in Jenkins
- Enter vSphere in the search bar and press enter
- Click Install without restart
- Click Manage Jenkins
Login to your Jenkins Server and make sure you can ping the VMC vCenter server by name
If you have worker nodes make sure the VMC vCenter is accesable from those too
Configure the vSphere Cloud with the following
- Enter a display name for this SDDC
- Enter the vCenter name as shown
- Create a new credential using the user name and password of your service account
- Click test connection to make sure it worked
- Click Save
Enter the following:
- Select Clone from VM or Template
- Enter the name of the Template you intend to use
- Enter the name of the new vm that will be cloned
- Enter the Cluster name you want this new VM deployed to usually Cluster-1
- Enter the resource pool, usually Compute-ResourcePool
- Enter the Datastore that is available from the Cluster you are deploying to usually WorkloadDatastore
- Enter the Folder where you want this stored
- Enter the customization Spec you want to use
- Check if you want to power it on
- Click to check data
- If success click OK to save
Note: You do not need to check Linked Clone in the Build setup if the template has a snapshot. It will do linked clone by default. If there is no snapshot it will do a full clone.
Click Build now and watch the magic begin
It is very fast because we are using linked clone. If you VM was configured correctly it should customize, rename the VM and you can login to it.
hi, do you have an example of a running pipeline scripting mode?
I want to reuse the node to execute commands in windows.
Thank you
It depends what your Jenkins server is running on if Linux based use the SSH Pipeline steps https://github.com/jenkinsci/ssh-steps-plugin
If Jenkins is on a Windows machine you can run psexec.exe or Powershell
More info here https://stackoverflow.com/questions/22553588/run-batch-scripts-on-a-remote-server-windows-from-jenkins