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.
- 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. ; -)
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
$1 >/dockerpull.log 2>&1 $2 >/dockerrun.log 2>&1
Press esc and hold shift and press ZZ to save the file
chmod u+x dockerpullandrun.sh
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
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 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
Login to vRA as cloudadmin and click the infrastructure tab, navigate to Blueprints then build profiles and create the following new build profile
Enter the following for the Build information
Remember to select you new snapshot that has the Docker Container script in it.
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.
Pingback: How to create a Photon Blueprint in vRA/vCAC | VMtoCloud.com