# Ansible Tower

> Configure and use the OneFuse Ansible Tower module with the Python module

---

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

---

To learn more about this OneFuse module, refer to [Ansible Tower](/docs/onefuse/configure/modules/ansible-tower/).

## Prerequisites

1. [Configure OneFuse Manager](/docs/onefuse/consume/python-module/getting-started/#configure-onefuse-manager)
1. Review an overview on [OneFuse Modules](/docs/onefuse/consume/python-module/modules/) with OneFuse Python Module

## Provision

Run provisioning job template(s) configured on the OneFuse Ansible Tower Policy for a resource.

### Method

```python
#Run the following in the Python Console
#Assumes OneFuse Manager is instantiated to 'ofm' variable

ofm.provision_ansible_tower('<policy_name>', <template_properties>, '<hosts>', '<limit>', '<tracking_id>')
```

### Parameter references

The following defines the function of each Ansible Tower specific parameter.

| Parameter name | Required? | Notes |
| --- | --- | --- |
| `policy_name` | Required | OneFuse Module Policy Name (string). |
| `template_properties` | Optional | Additional properties that are referenced within the Policy. Python [dict](https://www.w3schools.com/python/python_dictionaries.asp) format. |
| `tracking_id` | 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. |

**OneFuse Python Module Tracking ID methods:**

| Method name | Notes |
| --- | --- |
| `create_tracking_id()` | Generate a unique Tracking ID to link OneFuse Policy Executions and the resulting Managed Objects together. |
| `get_tracking_id_from_mo('<Path to OneFuse Managed Object>')` | Get the Tracking ID from a OneFuse Managed Object. |
| `add_tracking_id_to_headers('<Tracking ID>')` | Add Tracking ID into request headers. When making custom requests to OneFuse instead of using OneFuse Python Module methods provided. |

Learn more about OneFuse [Tracking ID](/docs/onefuse/concepts/tracking-id/).

**Ansible Tower specific parameters:**

| Parameter name | Required? | Notes |
| --- | --- | --- |
| `hosts` | Optional | List of specific hosts to execute against. Similar to `limit`, but will match against exact hostnames. |
| `limit` | Optional | Ansible Tower Policy Limit. Pattern matches hosts. For example, `dev-*` will match all hosts that start with "dev-". |

## Deprovision

Run deprovisioning job template(s), if configured on the OneFuse Ansible Tower Policy, for a resource.

### Method

```python
#Run the following in the Python Console
#Assumes OneFuse Manager is instantiated to 'ofm' variable

ofm.deprovision_ansible_tower('<at_id>')
```

### Parameter references

The following defines the function of the method parameter.

| Parameter name | Required? | Notes |
| --- | --- | --- |
| `at_id` | Required | ID of the OneFuse Ansible Tower Deployment Managed Object. |
