# Templating and Property Toolkit

> Use OneFuse Templating and Property Toolkit features with VMware vRealize Automation 7.6

---

Site [llms.txt](/llms.txt)

---

To learn more, refer to [Templating guide and Property Toolkit features](/docs/onefuse/templating/best-practices/).

## Introduction

**The OneFuse Property Toolkit (PTK) is the Swiss army knife of the OneFuse Platform.**

PTK can be used to simplify configurations, define business logic as configuration, build simple logic or tackle the most complex problems. At face value, the PTK is meta-data that can be called upon offering simple name value pairs that can be used as a reference for decision making. In its most powerful form, it can contain logic, decision trees, platform abstractions, and much more.

## Feature highlights

- Minimize automation inputs by presenting simple meaningful inputs, and leveraging policy-driven decisioning
- Reduce blueprint and configuration sprawl with dynamic blueprints and configurations
- Reduce custom code/technical debt in the areas of configurations and business logic
- Cross-platform/tool standardization
- Use OneFuse Property Sets to drive property assignment and rendering
  - Supports nested Property Sets
- Supports OneFuse Template Engine for both `key:value` pair.
- Supports ordering sets/groupings of properties by alphabetizing the after the Property Key prefix.

## Resources

- OneFuse Property Sets for Property Toolkit features
- OneFuse Property Sets for Upstream Providers

## Prerequisites

1. Configure OneFuse [Property Set(s)](/docs/onefuse/templating/property-sets/) and OneFuse Module Policies.
1. Run [OneFuse Configuration](/docs/onefuse/consume/vmware-aria-automation/vrealize-automation-76/installation-and-setup/#run-the-onefuse-configuration-workflow) per vRA Tenant.
1. Review the [OneFuse Modules](/docs/onefuse/consume/vmware-aria-automation/vrealize-automation-76/modules/) overview for vRealize Automation 7.6.
1. Create a new **vRA Blueprint** (if none exist) or determine which existing Blueprint(s) will utilize this OneFuse Module.
   - Resource: [Designing Machine Blueprints](https://docs.vmware.com/en/vRealize-Automation/7.6/com.vmware.vra.prepare.use.doc/GUID-62A92480-A122-4C89-A4E3-F8F6EC26C19E.html#GUID-62A92480-A122-4C89-A4E3-F8F6EC26C19E)

## Configure the Blueprint

1. **Know the name of the OneFuse Endpoint** created via [OneFuse Configuration](/docs/onefuse/consume/vmware-aria-automation/vrealize-automation-76/installation-and-setup/#run-the-onefuse-configuration-workflow).
1. **Determine which OneFuse Property Sets** are needed for this Blueprint.
1. **Determine which [vRA Properties](/docs/onefuse/consume/vmware-aria-automation/vrealize-automation-76/modules/properties-list/)** are needed for this Blueprint.
1. **Update the Blueprint** to add in necessary vRA Properties to influence other vRA Properties and OneFuse Policies.
1. **Deploy the Blueprint** to provision a vRA Deployment with dynamic configurations.

### Update the Blueprint

1. Log in to the **vRA Tenant**
1. Select the **Design** tab from the top menu bar
1. Select the **Blueprints** tab from the left menu
1. **Edit the Blueprint** and perform the below:

#### Add in necessary vRA Properties

The following vRA Properties need to be added to the Blueprint's **Properties** > **Custom Properties** section under the **Resource(s)** of interest.

**1. Trigger Property Toolkit:**

| Property Name Format | Property Value Format |
| --- | --- |
| `OneFuse_PropertyToolkit` | `<OneFuse Endpoint Name>:true` |

**Example vRA Custom Properties** (in `key: value` pair format)

```yaml
# OneFuse Property Toolkit - Simple Example

# -- Property Name
# <CustomID> is replaced with App, Env and 001Backup

# -- Property Value
# <OneFuse Endpoint Name>  is onefuse
# <OneFuse Property Set Name> is linux and prod
# <Property Name>  is Backup-VM
# <Property Value> is the provisioned resource hostname

OneFuse_PropertyToolkit: onefuse:true
OneFuse_SPS_App: linux
OneFuse_SPS_Env: prod
OneFuse_CreateProperties_001Backup: {"key":"Backup-VM", "value":"{{ OneFuse_VmNic0.hostname }}"}
```

**2. Add in additional vRA Properties:**

**2a. Method to add in properties from a OneFuse Property Set:**

| Property Name Format | Property Value Format |
| --- | --- |
| `OneFuse_SPS_<CustomID>` *(replace `<CustomID>` with a unique, user-defined friendly label)* | `<OneFuse Property Set Name>` |

**2b. Method to dynamically add in vRA Properties:**

| Property Name Format | Property Value Format |
| --- | --- |
| `OneFuse_CreateProperties_<CustomID>` *(replace `<CustomID>` with a unique, user-defined friendly label)* | `<JSON key:value pairs of Properties>` |

**Example vRA Custom Properties** (in `key: value` pair format)

```yaml
# Method A Example - Add in properties from OneFuse Property Set(s)
# !!Note: Starting in OneFuse v1.4, Static Property Sets was renamed to Property Sets.  Backwards compatibility exists.

# -- Property Name Format
# <CustomID> is App and Env

# -- Property Value Format
# <Property Set Names>: linux and prod
OneFuse_SPS_App: linux
OneFuse_SPS_Env: prod


# Method B Example - Create vRA Properties

# -- Property Name Format
# <CustomID> is 001Backup

# -- Property Value Format
# <Property Name>  is Backup-VM
# <Property Value> is the provisioned resource hostname
OneFuse_CreateProperties_001Backup: {"key":"Backup-VM", "value":"{{ OneFuse_VmNic0.hostname }}"}
```

##### CustomID

**CustomID** refers to a user specified text string to identify and can set an order of precedence for execution when calling multiple Policies for the OneFuse Module in the same vRA EBS State.

Replace `<CustomID>` variable with a unique custom identifier:

- Format is alphanumeric characters only `A-Z, a-z, 0-9`. No spaces, underscores, hyphens nor special characters.
- Must be unique across all EBS Execution Strings for the OneFuse Module on the specific VM for the Blueprint/Cloud Template.
- Is reusable either between different VM components of the Blueprint/Cloud Template canvas or between different Blueprints/Cloud Templates.

```yaml
# OneFuse Property Toolkit - Simple Example

# -- Property Name
# <CustomID> is replaced with App, Env and 001Backup

# -- Property Value
# <OneFuse Endpoint Name>  is onefuse
# <OneFuse Property Set Name> is linux and prod
# <Property Name>  is Backup-VM
# <Property Value> is the provisioned resource hostname

OneFuse_PropertyToolkit: onefuse:true
OneFuse_SPS_App: linux
OneFuse_SPS_Env: prod
OneFuse_CreateProperties_001Backup: {"key":"Backup-VM", "value":"{{ OneFuse_VmNic0.hostname }}"}
```

**Specify sorting with CustomID:**

When executing multiple different OneFuse Module's Policies in the same EBS State, prefix the `<CustomID>` with a numeric value (for example 001, 002, etc).

The `<CustomID>` is sorted prior to executing the OneFuse module's policies.

```yaml
# Example CustomID with sorting

001Apache
002WebApp
003BackupClient
```

##### Additional helpful vRA Properties

**Purpose: Relate OneFuse Policy executions from different OneFuse Modules together with a Tracking ID.**

| Property | Value format |
| --- | --- |
| `OneFuse_Tracking_Id` | A GUID (globally unique identifier) that links OneFuse Policy Executions and the resulting Managed Objects together for a given resource on a deployment. The first OneFuse Module Policy execution will populate this vRA property and it will be passed into other OneFuse Modules automatically. Learn more about OneFuse [Tracking ID](/docs/onefuse/concepts/tracking-id/). |

<div class="alert alert-info" role="alert">


When a Tracking ID is not provided, a Tracking ID gets generated for the Policy execution.
</div>


**Purpose: Reference a specific NIC's values to get hostname, IP Address, etc.**

| Property format | Example |
| --- | --- |
| `OneFuse_VmNic<#>.<value>` | See examples below |

Replace `<#>` with a number from `0` to `9`, one for each NIC.

Replace `<value>` with an appropriate key: `dnsSuffix`, `fqdn`, `gateway`, `hostname`, `ipAddress`, `macAddress`, `netmask`, `network`, `subnet`, `target`

<div class="alert alert-info" role="alert">


For most use cases, NIC 0 is the primary network interface and the target hostname is a Fully Qualified Domain Name (FQDN).
</div>


Examples:

- `OneFuse_VmNic0.dnsSuffix`
- `OneFuse_VmNic0.fqdn`
- `OneFuse_VmNic0.hostname`
- `OneFuse_VmNic0.ipAddress`
- `OneFuse_VmNic0.target`: when DNS Suffix is provided, will be the FQDN; otherwise, will be the hostname (without domain).

##### Custom property placement methods

Influence **Custom Properties** for Resources using different methods:

| Method | Description |
| --- | --- |
| Basic | Add a Custom Property to the vSphere machine on the blueprint canvas, or to the blueprint layer itself. |
| Advanced 1 | Add a Custom Property to an existing or new vRA [Property Group](https://docs.vmware.com/en/vRealize-Automation/7.6/com.vmware.vra.prepare.use.doc/GUID-73D5DB94-3B5D-410A-8E9C-CF42D4ADF6F0.html). |
| Advanced 2 | Add a Custom Property to a more global level, such as vCenter Endpoint (to run on all deployments) and/or a Reservation (to run on all deployments using that reservation), etc. |

Learn more: [Understanding Custom Properties Precedence](https://docs.vmware.com/en/vRealize-Automation/7.6/com.vmware.vra.prepare.use.doc/GUID-F45F332E-1003-45BC-BC05-0EA2FDE1B31F.html)

### Compiled example vRA Custom Properties

Review example below of vRA Custom Properties (in `key: value` pair format) for this OneFuse Module.

```yaml
# OneFuse Property Toolkit - Simple Example

# -- Property Name
# <CustomID> is replaced with App, Env and 001Backup

# -- Property Value
# <OneFuse Endpoint Name>  is onefuse
# <OneFuse Property Set Name> is linux and prod
# <Property Name>  is Backup-VM
# <Property Value> is the provisioned resource hostname

OneFuse_PropertyToolkit: onefuse:true
OneFuse_SPS_App: linux
OneFuse_SPS_Env: prod
OneFuse_CreateProperties_001Backup: {"key":"Backup-VM", "value":"{{ OneFuse_VmNic0.hostname }}"}
```

### Provision

Deploy a Blueprint with OneFuse Property Sets configured and/or Create Properties dynamically. The resource will be dynamically created.

#### Outputs

The user specified vRA Properties will exist on the deployment.

## vRA EBS

| EBS Execution | Subscription State | EBS Priority | EBS Name |
| --- | --- | --- | --- |
| MachineRequested | - | 1000 | OneFuse_PropertyToolkit_Requested |
| BuildingPre | Early | 1000 | OneFuse_PropertyToolkit_Building |
| ProvisionedPre | Early | 1000 | OneFuse_PropertyToolkit_Provisioned |

## Troubleshooting

Troubleshoot in vRealize Orchestrator.

1. Log in to **vRealize Orchestrator**.
1. Turn on [Verbose Logging](/docs/onefuse/consume/vmware-aria-automation/vrealize-automation-76/modules/#troubleshooting-verbose-logging) and try again to see additional log messages in vRO Workflows:
   - Select **Library** > **Workflows** from the left menu
   - Go to: **OneFuse** > **Property Toolkit** > **vRA7** to find corresponding workflow runs and view logs
   - Optionally, run the workflows in the **Manual** folder to manually test
1. Optionally, [configure timeouts for EBS](/docs/onefuse/consume/vmware-aria-automation/vrealize-automation-76/modules/event-broker-subscriptions/#configure-ebs-timeouts) and/or [Configure timeouts for OneFuse modules](/docs/onefuse/consume/vmware-aria-automation/vrealize-automation-76/installation-and-setup/#configure-timeouts-for-onefuse-modules).

**Additional resources:**

- Review [Troubleshooting in OneFuse](/docs/onefuse/getting-started/troubleshooting/)
- Review [VMware troubleshooting resources](/docs/onefuse/consume/vmware-aria-automation/vrealize-automation-76/getting-started/#troubleshooting)
