You can create custom resources that you can use to build cloud templates using Automation Orchestrator workflows. In this use case, you add a custom resource that adds an SSH host. You can then include the resource in cloud templates. This procedure also adds an update workflow so that users change the SSH configuration after deployment rather than perform individual day 2 actions.
Custom resources are Automation Orchestrator or extensibility action objects that you manage through Automation Assembler with the lifecycle actions defined in the custom resource. The cloud template service automatically calls up the appropriate Automation Orchestrator workflows or extensibility actions when the operation associated with a specific lifecycle action is triggered. You can extend the functionality of the resource type by also selecting Automation Orchestrator workflows or extensibility actions that can be used as day 2 operations.
This use case uses built-in workflows provided in the Automation Orchestrator library. It includes prescriptive values or strings to demonstrate how to perform the process. You can modify them to suit your environment.
For reference purposes, this use case uses a project named DevOpsTesting. You can replace the project with one that you already have.
Prerequisites
- Verify that you configured an Automation Orchestrator integration. See Configure an Automation Orchestrator integration in Automation Assembler.
- Verify that the workflows that you are using for the create, update, destroy, and day 2 actions exist in Automation Orchestrator and run successfully from there.
- In Automation Orchestrator, locate the resource type used by the workflows. The workflows included in this custom resource must all use the same resource type. In this use case, the resource type is
SSH:Host
. For more information on resource type validation, see Custom resource types for Automation Assembler cloud templates.
- Verify that you know how to configure and deploy a machine cloud template.
Procedure
- Create an SSH host custom resource for adding SSH to a cloud template.
This step adds the custom resource to the cloud template design canvas as a resource type.
- In Automation Assembler, select , and click New Custom Resource.
- Provide the following values.
Remember, except for the workflow names, these are sample values.
Table 1.
Setting |
Sample Value |
Name |
SSH Host - DevOpsTesting Project This is the name that appears in the cloud template resource type palette. |
Resource Type |
Custom.SSHHost The resource type must begin Custom. and each resource type must be unique. Although the inclusion of Custom. is not validated in the text box, the string is automatically added if you remove it. This resource type is added to the design canvas so that you can use it in the cloud template. |
- To enable this resource type in the cloud template resource type list, verify that Activate option is toggled on.
- Select the Scope setting that makes the resource type available to the DevOpsTesting project.
- Under Based on, verify that vRO Inventory is selected as the lifecycle action provider.
- Select the workflows that define the resource.
Setting |
Setting |
Lifecycle Actions - Create |
Select the Add SSH Host workflow. If you have multiple Automation Orchestrator integrations, select the workflow on the integration instance you use to run these custom resources. After select the workflow, the external type drop-down menu becomes available and is automatically set to SSH:Host . An external source type can be used only once if share and once per project. In this use case, you are providing the custom resource for only the DevOpsTesting project. If you had other workflows that require the SSH:Host type, you must create individual custom resources for each project. |
Lifecycle Actions - Update |
Select the Update SSH Host workflow. |
Lifecycle Actions - Destroy |
Select the Remove SSH Host workflow. |
- Review the schema key and type values in the Properties tab so that you understand the workflow inputs so that you can configure the inputs in the cloud template.
The schema lists the required and optional input values defined in the workflow. The required input values are included in the cloud template YAML.
In the Add SSH Host workflow, hostname
, port
, and username
are required input values. The other schema properties are not required. You can also use the schema to determine where you want to create bindings to other field values, workflows, or actions. Bindings are not included in this use case.
- To finish creating your custom resource, click Create.
- Create a cloud template that adds the SSH host when you deploy it.
- Select , and click .
- Name the cloud template Machine with SSH Host.
- Select the DevOpsTesting project, and click Create.
- Add and configure a vSphere machine.
- From the custom resource list on the left of the cloud template design page, drag the SSH Host - DevOpsTesting Project resource type onto the canvas.
Note: You can select the custom resource by either scrolling down and selecting it from the left pane, or searching for it in the
Search Resource Types text box. If the custom resource does not appear, click the refresh button next to the
Search Resource Types text box.
A reminder that the resource type is available because it was configured for the project. If you were creating a cloud template for another project, you cannot see the resource type.
- On the right, edit the YAML code to add the mandatory input values.
Add an
inputs
section in the code so that users can provide the user name and the host name at deployment time. In this example, the port default is 22. In the following example, some of these values are sample data. Your values might be different.
inputs:
hostname:
type: string
title: The hostname of the SSH Host
username:
type: string
title: Username
- In the
resources
section, add ${input.input-name}
code to prompt for the user selection.
resources:
Custom_SSHHost_1:
type: Custom.SSHHost
properties:
port: 22
hostname: '${input.hostname}'
username: '${input.username}'
- Deploy the cloud template.
- On the cloud template designer page, click Deploy.
- Enter the Deployment Name SSH Host Test.
- Select the Cloud Template Version and click Next.
- Complete the deployment inputs.
- Click Deploy.
- Monitor the provisioning request on the Deployments page to ensure that the SSH host is included in the deployment and that the deployment is successful.
What to do next
When your tested cloud template is working, you can then begin using the SSH Host custom resource with other cloud templates.