Container as a service with vRA/vCAC and Project Photon

Updated 12/7/15, vRO workflows updated to address a reported timing issue. In my last post I showed you how to create a Photon Blueprint in vRA that uses a static IP pool and customizes the Photon guest OS. In this guide let’s take it a step further and allow the requestor to select what container image they want to pull and run in the guest.

Pre-Reqs

  • A working Photon TP1 Blueprint Successfully provisioning from vRA/vCAC based on my guide here
  • This guide is expecting your Photon VM has access to the internet to pull the images, if not you will need to create a local registry see here
  • A quite place where you will not be interrupted, sorry no guide for that. ; -)

Installation

We will need to add another script to the Photon base VM. Power on the Photon VM in vCenter and login to it and enter the following command and hit enter to set the docker service to start when the VM boots up. Note: If you are using a local Docker registry you will need to start Docker differently. See my guide here.

Now change directories to / and us vi to create a file named dockerpullandrun.sh

systemctl enable docker

In the vi editor press i to change to insert mode then enter the following

$1 >/dockerpull.log 2>&1
$2 >/dockerrun.log 2>&1

Press esc and hold shift and press ZZ to save the file

Enter the following and press enter to make the script executable.

chmod u+x dockerpullandrun.sh

Shutdown the Photon VM and take a new snapshot and name it basewithdocker

Now login to vRA as an administrator and go to the infrastructure tab, then computer resources, compute resources then hover over your vCenter Cluster and click

Click to request an inventory scan

Now download the new vRO package I created. It contains the workflow that will customize Photon as part of the build process. Remember it is in a ZIP file, you will need to unzip it before the next step.

Now login to vRO and change to Administer and install the package you just downloaded.

Now change to Run and navigate to the PhotonvRACustomizeGuest workflow and right click and select edit

Go to the general Tab and change the vmUsername and vmPassword to whatever you set it when you deployed you Photon VM

Save and close the workflow and locate the ID of the workflow and copy it to the clipboard.

Login to vRA as cloudadmin and click the infrastructure tab, navigate to Blueprints then build profiles and create the following new build profile

Now go to blueprints and create a new vSphere Blueprint

Enter the following on the Blueprint information Tab

Enter the following for the Build information

Remember to select you new snapshot that has the Docker Container script in it.

Enter the following on the Properties screen

Publish the blueprint, entitle it and fire off a new request with your pull and run command entered.

After a few minutes go to items tab and open your new VM and go to network properties, Open a Web browser to that IP and let the magic begin.

 Enjoy!
Remember, sharing is caring ->Tweet about this on Twitter
Twitter
0Share on Facebook
Facebook
0Share on LinkedIn
Linkedin
Share on Google+
Google+
0Email this to someone
email

One Reply to “Container as a service with vRA/vCAC and Project Photon”

  1. Pingback: How to create a Photon Blueprint in vRA/vCAC | VMtoCloud.com

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.