CHEF: vRA Integration, Property Groups and Blueprints
The Chef plugin provides some workflows to help with getting the vRA integration up and running with minimal effort. I would suggest treating them as samples to build functionality on top of. There are some limitations from the default state which might not provide sufficient flexibility for production usage.
Setting up the Property Groups:
Launch the vRO Client and navigate to the Chef workflow ‘Create Property Group for Chef EBS Workflows’.
Run the workflow and enter the required information
- Property Group Name
- Unique name to identify the property group in vRA
- Chef Runlist
- Array of run lists to be run as part of the first run
- Install Chef Client on VM’s
- This Boolean option determines if the Chef client is to be installed
- Windows MSI Installer URL
- While this entry doesn’t have isn’t relevant to Linux VMs, the field is mandatory.
- Install As service
- Again, only relevant to Windows, but is optional
- Guest Username and Password
- Enter credentials that will be available at the time of deployment
- If you’re using guest customization scripts to create accounts, these will be created before the POST Machine Provisioning event which installs the Chef client.
Click Submit and wait for the workflow to complete.
Checking Property Group in vRA
Login into your vRA tenant and go to Administration > Property Dictionary > Property Groups.
Here you will see the new group that you just created. If you like, you can remove options where are not required, such as the MSI path if it’s not required.
Adding Property Group to a Blueprint
In vRA navigate to Design > Blueprints and select an existing IaaS blueprint or create a new one. The blueprint should deploy a Virtual Machine, I have only tested this with a vSphere VM, no other deployments yet.
From the blueprint, select the virtual machine and go to properties and Click Add then select your Property Group. You can view the properties that have been imported through the button ‘View Merged Properties’ at the bottom left.
Save and Close the blueprint. At this point, I will assume that you have gone through the catalog deployment steps.
To make the Install Chef Client workflow fire when a Virtual Machine is deployed, we need to configure an EBS subscription. The subscription will run when an event matching the specified conditions occurs.
Navigate to Administration > Events > Subscriptions.
Select New and from the list of Event Topics select ‘Machine Provisioning’. Click Next
Set up the conditions as below
- Data > Lifecycle State > State Name, Equals, VMPSMasterWorkflow32.MachineProvisioned
- Data > Lifecycle State > State Phase, Equals, Post
- Data > Machine, Machine Type, Equals Virtual Machine
Under the Workflow Tab, navigate through the vRO menu tree to ‘EBS – Machine Provisioned – Chef’. Click Next
On the final tab, you can choose if the event will be blocking or not. A blocking event will run before any non-blocking event. If there are multiple blocking events, they will run in the priority order set.
The choice of using blocking here depends on your requirements for other post provision workflows.
After clicking Finish make sure to publish the new event subscription.
Starting a Workflow
Under the Catalog Tab, request the blueprint that you added the Chef property group too. If you select the VM and select Properties, you can view and edit the values for the properties in the property group. Additional configuration can prevent these values from being changed.
After submitting the workflow, the Chef client will install on the new VM and perform normal bootstrap operations.
With some more work, you can populate these items from user input selections. For example, the value of ‘runlist’ can be set based on the application a user would like installed.
The Chef plugin has provided some easy options to get started with deploying the Chef client to provisioned VMs using vRA. Consider the properties as a getting started point, to get real value think of ways to expand how the age is deployed.
For example, the Chef server might be selected based on the vRA Business Group a User is a part of. Or the Chef environment could be selected based on the cluster a VM is deployed to.