# IPAM

> Configure and use the OneFuse IPAM module with VMware Aria Automation 8x/Cloud

---

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

---

To learn more about this OneFuse module, refer to [IPAM](/docs/onefuse/configure/modules/ipam/).

## Prerequisites

1. Configure OneFuse [Property Set(s)](/docs/onefuse/templating/property-sets/) and OneFuse Module Policies.
2. Run OneFuse Configuration per Cloud Assembly Organization.
3. Review an overview on OneFuse Modules with Aria Automation 8.1+/Cloud.
4. Create a new **Cloud Template** (if none exist) or determine which existing Cloud Template(s) will utilize this OneFuse Module.
   - Resource: [Designing your vRealize Automation Cloud Assembly deployments](https://docs.vmware.com/en/vRealize-Automation/8.1/Using-and-Managing-Cloud-Assembly/GUID-BFD33C28-ADCC-43F4-BE43-CC92B62FBE2E.html)

## Steps

1. **Know the name of the OneFuse Endpoint** created via [OneFuse Configuration](/docs/onefuse/consume/vmware-aria-automation/aria-automation-8x/installation-and-setup/#run-the-onefuse-configuration-workflow).
2. **Determine which OneFuse IPAM Policies to run** for this Cloud Template.
3. **Update the Cloud Template** to add in the necessary vRA Properties and/or add in the Custom Resource to invoke a OneFuse IPAM Policy.
4. **Deploy the Cloud Template** to provision a vRA Deployment and reserve IP Address(es).
5. **Destroy the vRA Deployment** to remove the IP Address(es) for the destroyed resource(s).

### Update the Cloud Template

1. Log in to vRA > **Cloud Assembly**
2. Select the **Design** tab from the top menu bar
3. Select the **Cloud Templates** tab from the left menu
4. **Edit the Cloud Template** and perform the below:

#### Option 1: Add in necessary vRA Property

The following vRA Property needs to be added to the Cloud Template's **Code** section under the **Resource(s)** of interest.

| Property Name Format | Property Value Format |
| --- | --- |
| `OneFuse_IpamPolicy_Nic<#>`: Replace `<#>` with a number from `0` to `9`, one for each NIC. Default is `0` | `'<OneFuse Endpoint Name>:<IPAM Policy Name>'` |

**Example YAML:**

```yaml
# Execute OneFuse IPAM Policy

# -- Property Value
# <OneFuse Endpoint Name>  is onefuse
# <IPAM Policy Name> is prod

name: Simple Example
resources:
  Cloud_Machine_1:
    type: Cloud.Machine
    properties:
      image: CentOS7
      flavor: small
      count: 1
      OneFuse_IpamPolicy_Nic0: 'onefuse:prod'
```

**Optional. IPAM Multi-IP Support:**

Support for multiple IP Addresses on a single interface. The IP Addresses are reserved and stored in both OneFuse and vRA Machine Properties for future reference in vRA lifecycles.

| Property name format | Property value format |
| --- | --- |
| `OneFuse_IpamPolicy_AdditionalTrigger` | `'true'`. Required Trigger Property to enable IPAM for additional NICs. |
| `OneFuse_IpamPolicy_Additional_<niclabel>` | `'<OneFuse Endpoint Name>:<IPAM Policy Name>'` |

- Replace `<niclabel>` with a value that is appended to the hostname.
- Default behavior appends `<niclabel>` to the hostname after a hyphen (-). To override, modify the **Hostname Override** field on the OneFuse IPAM Policy.
- **Without** Additional Naming Property: default behavior of the `<niclabel>` is to get appended to the hostname after a hyphen (-). To override this behavior, modify the field **Hostname Override** on the OneFuse IPAM Policy.
- **With** Additional Naming Property: if an Additional Naming Policy is defined that matches this value, the name generated from the Naming Policy will be used.

**Example YAML:**

```yaml
# -- Property Name
# <niclabel> is xyz

# -- Property Value
# <OneFuse Endpoint Name>  is onefuse
# <OneFuse IPAM Policy Name> is prod

# Example
OneFuse_IpamPolicy_AdditionalTrigger: 'true'
OneFuse_IpamPolicy_Additional_xyz: 'onefuse:prod'
```

##### Additional helpful vRA properties

| Property | Value |
| --- | --- |
| `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/). |

- The first OneFuse Module Policy execution will populate this property and pass it into other OneFuse Modules automatically.
- When a Tracking ID is not provided, one is generated for the Policy execution.

| Property format | Example |
| --- | --- |
| `OneFuse_VmNic<#>.<value>` | `OneFuse_VmNic0.hostname`, `OneFuse_VmNic0.ipAddress`, `OneFuse_VmNic0.fqdn` |

- Replace `<#>` with a number from `0` to `9`, one for each NIC. For most use cases, NIC 0 is the primary network interface.
- Replace `<value>` with an appropriate key: `dnsSuffix`, `fqdn`, `gateway`, `hostname`, `ipAddress`, `macAddress`, `netmask`, `network`, `subnet`, `target`
- `target` will be the FQDN when a DNS Suffix is provided; otherwise, it will be the hostname without domain.

##### Example Cloud Template YAML

```yaml
# Execute OneFuse IPAM Policy

# -- Property Value
# <OneFuse Endpoint Name>  is onefuse
# <IPAM Policy Name> is prod

name: Simple Example
resources:
  Cloud_Machine_1:
    type: Cloud.Machine
    properties:
      image: CentOS7
      flavor: small
      count: 1
      OneFuse_IpamPolicy_Nic0: 'onefuse:prod'
```

---

#### Option 2: Add in Custom Resource for OneFuse IPAM

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


Review [OneFuse custom resources](/docs/onefuse/consume/vmware-aria-automation/aria-automation-8x/modules/custom-resources/) before using this method.
</div>


- From the **Resource Types** navigation and expand **Custom Resources**
- Drag-and-drop `OneFuse:IPAM_v1` to the canvas
- In the **Code** tab, provide values for the following *properties*:

| Parameter Name | Required? | Notes |
| --- | --- | --- |
| `endpointName` | Required | OneFuse Endpoint Name in vRA. Refer to [Managing endpoints](/docs/onefuse/consume/vmware-aria-automation/aria-automation-8x/installation-and-setup/#managing-endpoints). |
| `policyName` | Required | OneFuse Module Policy Name (string). |
| `templateProperties` | *Optional* | Additional properties that are referenced within the Policy. JSON format. |
| `trackingId` | *Optional* | Tracking ID (string) to link multiple OneFuse Policy Executions and resulting OneFuse Managed Objects together. If none is passed, one gets generated by OneFuse for that specific Policy Execution. |

**IPAM specific parameters:**

| Parameter Name | Required? | Notes |
| --- | --- | --- |
| `hostname` | **Required** | Hostname for the IP Address |

### Provision

Deploy a Cloud Template with OneFuse IPAM Policies configured. IP Address(es) will get reserved in the desired IPAM Provider.

#### Outputs

The following vRA Properties will exist on the Deployment.

| Property Name | Property Value |
| --- | --- |
| `OneFuse_Ipam_Nic#`: Where `#` is a number `0`-`9` | *JSON string of OneFuse IPAM Managed Object* |
| `OneFuse_Ipam_Additional<niclabel>` *(shown when configured to register additional IPs)*: where `niclabel` is replaced with the user specified value | *JSON string of OneFuse IPAM Managed Object* |

### Deprovision

Destroy an existing deployment with OneFuse IPAM Policies configured. The IP Address(es) will be removed from the desired IPAM Provider.

## vRA EBS

| EBS Execution | Subscription State | EBS Priority | EBS Name |
| --- | --- | --- | --- |
| **Provision** | | | |
| NetworkConfigure | Early | 1200 | OneFuse_Provision_IPAM |
| **Deprovision** | | | |
| ComputePostRemoval | - | 1400 | OneFuse_De-Provision_IPAM |

## Troubleshooting

Troubleshoot in vRealize Orchestrator.

1. Log in to **vRealize Orchestrator**.
2. Turn on [Verbose Logging](/docs/onefuse/consume/vmware-aria-automation/aria-automation-8x/modules/#troubleshooting-verbose-logging) and try again to see additional log messages in vRO Workflows:
   1. Select **Library** > **Workflows** from the left menu
   2. Go to: **OneFuse** > **IPAM** > **vRA8** to find corresponding workflow runs and view logs
   3. Optionally, run the workflows in the **Manual** folder to manually test
3. Optionally, [configure timeouts for EBS](/docs/onefuse/consume/vmware-aria-automation/aria-automation-8x/modules/event-broker-subscriptions/#configure-ebs-timeouts) and/or [Configure timeouts for OneFuse modules](/docs/onefuse/consume/vmware-aria-automation/aria-automation-8x/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/aria-automation-8x/getting-started/#troubleshooting)

---

Section pages:

- [IPAM network selection support](/docs/onefuse/consume/vmware-aria-automation/aria-automation-8x/modules/ipam/ipam-network-selection-support/): How to derive OneFuse IPAM Policy inputs from Aria Automation 8 Network Selection IDs to let vRA constraints drive IP address reservations
