How to Configure Jenkins for VMware Cloud on AWS VM’s

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

Provide name and description for snapshot and click create

Login to Jenkins and Install the vSphere Plugin

  1. Click on Manage Jenkins
  2. Manage Plugins

Install the vSphere Plugin in Jenkins

  1. Enter vSphere in the search bar and press enter
  2. Click Install without restart
  3. 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

Click Manage Nodes and Clouds

Now click Configure Clouds

Configure the vSphere Cloud with the following

  1. Enter a display name for this SDDC
  2. Enter the vCenter name as shown
  3. Create a new credential using the user name and password of your service account
  4. Click test connection to make sure it worked
  5. Click Save

Now let’s create a test job

Click on New Item

Create a new Freestyle Project named Dev-test

  1. Enter the name
  2. Click Freestyle Project
  3. Click OK

Add new vSphere Build Step

  1. Scroll down and click Add build step
  2. Select vSphere Build Step

Enter the following:

  1. Select Clone from VM or Template
  2. Enter the name of the Template you intend to use
  3. Enter the name of the new vm that will be cloned
  4. Enter the Cluster name you want this new VM deployed to usually Cluster-1
  5. Enter the resource pool, usually Compute-ResourcePool
  6. Enter the Datastore that is available from the Cluster you are deploying to usually WorkloadDatastore
  7. Enter the Folder where you want this stored
  8. Enter the customization Spec you want to use
  9. Check if you want to power it on
  10. Click to check data
  11. 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

You should see a new VM in the folder you specified in vCenter

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.

If the build failed

Click the build on the left in Jenkins

View the Console Output

Click Console Output on the left

Remember sharing is caring!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.