vRA Cloud Template and One Fuse Script

Mindwatering Incorporated

Author: Tripp W Black

Created: 10/27 at 01:29 PM

 

Category:
VMWare
vRA

Task:
Add a script to the OneFuse appliance and include it in a vRA 8.x Cloud Template (Blueprint).

In this example, we will be adding an Ubuntu script for One Fuse.

Notes:
The Scripting Policy Name is the keyword/bubble gum that connects the script to the vRA Cloud Template (Blueprint).
Typically the Rocky or CentOS local user is "root". Typically the Windows local user is "Administrator". Ubuntu VMs will vary because of root not having SSH and the "first" username can be anything.
For MS Windows VMs, the format for PowerShell is: PowerShell -File {{scriptName}}.


Part A: One Fuse
Create the Script:
Modules (menu) --> Scripting (submenu option) --> +Create button

1. General tab:
Scripting Policy Name: ubuntu_ScriptTask
Description: Updates ubuntu performing scriptTask to solve scriptReason
Target Host: {{OneFuse_VmNic0.fqdn}}
Module Credential: Ubuntu_Admin

2. Provisioning tab:
Launch Command: /bin/bash/{{scriptName}}
Script Template: <paste in the contents of the script to run>

Replace any variables to be added like: {{someproperty}}.

Success Exit Code: 0
(0 is typically a success)

Click the Save button.


Part B: vRA - Update the Cloud Template (blueprint template)
Update the Cloud Template in Cloud Assembly:
1. Cloud Assembly --> Design (top menu) --> Click/select/open the cloud template under name (e.g. MW OS VM).

2. In the right window/frame, select Code.

3. Close the inputs twistie/category to collapse all that.

4. Under the resources twistie, look for:
resources:
vSphere Machine:
type: Cloud.vSphere.Machine
properties:

Under the properties add the OneFuse scripting policy:
OneFuse_ScriptingPolicy_Trigger_ComputeProvisionPostLate: 'true'
OneFuse_ScriptingPolicy_ComputeProvisionPostLate_001ubuntuScriptTask: '${input.propOS="ubuntu"? propgroup.oneFuse.endpoint + ":" + input.propOS + "_ScriptTask": null)'


Note:
There only needs to be one OneFuse_ScriptingPolicy_Trigger_ComputeProvisionPostLate true line. Only add it, if your cloud template doesn't already have it.

5. Save and Upload to Git
Click Version, to save the update.
In the Creating Version dialog:
Version: 1.2
(Do one higher than the "Last Version: 1.1" )
Description: Updated MW OS VM template to include new script to run after machine is cloned.
Release <check> Release this version to the catalog
Click Create.


Part C: vRA - Enable the update Cloud Template in Cloud Assembly
1. Service Broker --> Content & Policies (top menu) --> Content Sources (side menu) --> Click/select/open Machine Blueprints (source on right).

2. On the Content Source Details page, click Validate (button).
It should say something like 1 update found. Click Save & Import (button).

3. Return to the Catalog (top menu) and Request the blueprint.



previous page