Rubrik provides a simple, SLA-based backup and recovery solution which integrates with vCenter based on-premise private clouds. This backup and recovery solution can be integrated into vCommander to allow you to automatically protect your VMs when deployed, take on-demand backup Snapshots and manage the backup Snapshots taken by the Rubrik solution.


Requirements



 The steps below assume you have connected a vCenter system to your vCommander install and that the same vCenter has been added to your Rubrik solution.


Create the Required Custom Attributes


The first step is to create the SLA Custom Attribute, and other required attributes, which will be used to allow you to set the Rubrik SLA which will be applied to VMs created in your service requests.

  1. Log into your vCommander Admin console. Under the Configuration menu, click Custom Attributes. Click Add.
  2. On the Define Attributes page set the Custom Attribute as follows:

    Name: Rubrik SLA
    Type: List
    Applies To: All
    Edit in Service Portal: Enabled

  3. Click Next. On the Configure Attributes page do not add any values. The values will be added automatically by the SLA Sync script which we will configure later. Click Finish.
  4. Create a Custom Attribute. On the Define Attributes page set the Custom Attribute as follows:

    Name: Take Rubrik Snapshot?
    Type: List
    Applies To: All
    Edit in Service Portal: Enabled

    Click Next and Add these Allowed Values: Yes, No

    Click Finish to save the Custom Attribute.

  5. Create a Custom Attribute. On the Define Attributes page set the Custom Attribute as follows:

    Name: Apply SLA?
    Type: List
    Applies To: All
    Edit in Service Portal: Enabled

    Click Next and Add these Allowed Values: Yes, No

    Click Finish to save the Custom Attribute.

  6. Create a Custom Attribute. On the Define Attributes page set the Custom Attribute as follows:

    Name: Clear Previous Snapshots?
    Type: List
    Applies To: All
    Edit in Service Portal: Enabled

    Click Next and Add these Allowed Values: Yes, No

    Click Finish to save the Custom Attribute.

Configure the SLA Sync Workflow Scrip and Scheduled Task


  1. To configure the script, open the Rubrik_SLA_Sync_Workflow.ps1 file. In the Customer Configured Variables section set the IP of your Rubrik server, set the Rubrik credentials, set the vCommander Server address and the file path to your vCommander credentials file.
    The Rubrik credentials should be a Base64 encoded username and password pair in the form:
        UserName:Password

    Save and close the file.

  2. Now that the script is configured you will need to create a task which will call the script on a schedule. To accomplish this we will use the Windows Task Scheduler.
  3. Open Windows Task Scheduler, click the Create Basic Task link on the right.
  4. Enter "Rubrik SLA Sync" as the task Name an click Next.


  5. Set the task Frequency to Daily and click Next.

  6. Set the start time and set the task to recur every 1 day and click Next. Be sure to pick a time that is during your "off hours" so you minimize any potential impact on the system.

  7. Set the task action to "Start a Program" and click Next.

  8. On the Start a Program screen, click Browse and select the Rubrik_SLA_Sync_Workflow.ps1 file. Click Open and click Next.

  9. On the summary page, click Finish.

  10. Now, run the newly created Task in Windows Task Manager to populate the Rubrik SLA Custom Attribute.


Create the Workflow to Apply the Rubrik SLA to a New VM


  1. To configure the script, open the Rubrik_Provisioning_Workflow.ps1 file. In the Customer Configured Variables section set the IP of your Rubrik server, set the Rubrik credentials, set the vCommander Server address and the file path to your vCommander credentials file.
    The Rubrik credentials should be a Base64 encoded username and password pair in the form:
        UserName:Password

    Save and close the file.

  2. Now that the script is configured you will need to create a Completion Workflow to apply the Rubrik SLA to the VM. Log into your vCommander Administrative page.
  3. Select Configuration -> Service Request Configuration from the top menu. Then click the Completion Workflow tab.
  4. Click the Add button, then enter "Apply Rubrik SLA to VM" as the Name and set the Apply this workflow value as "after a VM is deployed" and click Next.

  5. On the Steps page, click Add and select an Execute Script step type. Set the Command Line text box to:
    powershell.exe c:\Scripts\Rubrik\Rubrik_Provisioning_Workflow.ps1 -TargetVMName "#{target.deployedName}" -RemoteID "#{target.remoteId}" -RequestID "{request.id}"

    Click Next.

  6. On the Assigned Components page, select the Service Components you want to apply this Workflow against. Click Next.
  7. On the Summary page, click Finish to save the Workflow.


Configure the Service Form


  1. Click the Form Designer tab. Select the Default Service form from the left hand side.
  2. Click the Custom Attribute link on the right hand side. From the Custom Attribute dropdown select the Rubrik SLA custom attribute. Check the Required checkbox and click OK.

  3. Click the Save button to save the form changes.


Create and Configure the On Demand Snapshot and Clear Snapshot Workflow


Next, we will configure a Workflow to run as part of a Change Request. This Workflow will allow you to take On-Demand Snapshots using the Rubrik system as well as clear old Snapshots.

  1. From the top menu select Configuration -> Configure Service Requests and then click the Completion Workflow tab.
  2. Click the Add button to create a new workflow. Set the Name of the Workflow to "Rubrik - On Demand Snapshot / Purge Snapshots" and set the Apply this Workflow setting to "after a Change Request is fulfilled". Click Next.

  3. On the Steps page, click Add and select an Execute Script step type. Set the Step Name to "Take On Demand Snapshot". Set the Command Line box to:
    powershell.exe c:\Scripts\Rubrik\Rubrik_OnDemand_Snapshot.ps1 -TargetVMName "#{target.deployedName}" -RemoteID "#{target.remoteId}" -RequestId "#{request.id}"


  4. Add a second Step. Choose Execute Script for this Step Type as well. Set the Step Name to "Purge Snapshots". Set the Command Line box to:
    powershell.exe c:\Scripts\Rubrik\Rubrik_Purge_Snapshots.ps1 -TargetVMName "#{target.deployedName}" -RemoteID "#{target.remoteId}" -RequestId "#{request.id}"


  5. Click Next to save the Steps. On the Assigned Forms page select the Resource Change Request form type and click Next.

  6. On the Summary page, click Finish to save the Workflow.

  7. To configure the Rubrik_Purge_Snapshots script, open the Rubrik_Purge_Snapshots.ps1 file. In the Customer Configured Variables section set the IP of your Rubrik server, set the Rubrik credentials, set the vCommander Server address and the file path to your vCommander credentials file.
    The Rubrik credentials should be a Base64 encoded username and password pair in the form:
        UserName:Password

    Save and close the file.

  8. To configure the Rubrik_OnDemand_Snapshot script, open the Rubrik_OnDemand_Snapshot.ps1 file. In the Customer Configured Variables section set the IP of your Rubrik server, set the Rubrik credentials, set the vCommander Server address and the file path to your vCommander credentials file.
    The Rubrik credentials should be a Base64 encoded username and password pair in the form:
        UserName:Password

    Save and close the file.


Create the On Demand Snapshot and Clear Snapshot Form Fields


Now that the Workflow is created, we need to configure the Form fields to provide the necessary information to allow the scripts in the Workflow steps to function properly.


The form will contain four additional fields:
    Take Rubrik Snapshot? -  This field will control whether or not you want to take an On Demand Snapshot. If you do, set it to Yes.

    Apply SLA? -  This field will control whether or not you want to apply the VMs current SLA to the On Demand Snapshot. If you do, set it to Yes.

    Clear Previous Snapshots? -  This field will control whether or not you want to Delete old Snapshots. If you do, set it to Yes.

    Clear Snapshots Before - This Date field will control which Snapshots should be deleted. If you set Clear Previous Snapshots to Yes, then set this field. Every Snapshot older than this date will be deleted.

  1. From the top menu select Configuration -> Configure Service Requests and then click the Form Designer tab.
  2. Select the Resource Change Request item from the right hand side. Click the Custom Attribute link on the left hand side. Select the "Take Rubrik Snapshot?" Custom Attribute from the drop down and check the Required box. Click OK
  3. Repeat Step 2 and add the "Clear Previous Snapshots?" and "Apply SLA?" Custom Attributes as well. Check the Required box for both these items.
  4. Click the Expiry Date link in the toolbox on the left hand side. Set the Display Label to "Clear Snapshots Before". Clear the Allow "Never Expires" checkbox and the Required checkbox. Click OK.
  5. Click Save to save the changes to the Form.


Configure the De-Provisioning Workflow


Finally, we need to configure a workflow to remove the Rubrik SLA when a VM is deprovisioned.

  1. To configure the script, open the Rubrik_Deprovisioning_Workflow.ps1 file. In the Customer Configured Variables section set the IP of your Rubrik server and set the Rubrik credentials.
    The Rubrik credentials should be a Base64 encoded username and password pair in the form:
        UserName:Password

    Save and close the file.

  2. From the top menu select Configuration -> Configure Service Requests and then click the Completion Workflow tab.
  3. Click the Add button. Set the Name as "Remove Rubrik SLA" and set the Apply this workflow to "after a Change Request is fulfilled". Click Next.
  4. On the Steps page, click Add and select an Execute Script step type. Set the Name as "Execute Remove SLA Script". Set the Command line to:
    powershell.exe c:\Scripts\Rubrik\Rubrik_Deprovisioning_Workflow.ps1 -TargetVMName "#{target.deployedName}" -RemoteID "#{target.remoteId}"


  5. Click Next. On the Assigned Forms page select the Decommissioning Request under the "Apply this Workflow to the selected forms" section. Click Next.
  6. On the Summary page click Finish.