# Deploy from a template

Deploy resources (Nodes, Hosts, Services, Secrets, storage, etc.) to a Tenant using the DuploCloud Stacks feature.

## Uploading templates

Upload templates in advance to make them available for deployment across all Tenants or for a specific Tenant to make them available only within that Tenant's environment. You can upload a template for a specific Tenant ahead of time, or at the time of deployment.

### Uploading a template for all Tenants

1. From the DuploCloud Portal, navigate to **Administrator** -> **System Settings**.
2. Select the **Templates** tab.
3. Click **Upload**. The **Upload Template** pane displays.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2Fyd3la1veDPMozxbPLwQt%2Fupload%20template%20pane.png?alt=media&#x26;token=f0d0174c-3949-42f4-aad1-6fc04bd3b036" alt="" width="374"><figcaption><p>The <strong>Upload Template</strong> pane</p></figcaption></figure></div>
4. Enter a name for the template in the **File Name** field.
5. In the **Module Type** list box, **Stack** is selected by default. For steps related to the **Agent** Module Type, see below.
6. Click **Choose File** and select the file to upload.
7. Click **Upload**.

### Uploading a template for a specific Tenant

1. Select the Tenant that will use the template from the **Tenant** list box.
2. Navigate to **Automation** -> **Stacks**.
3. Select the **Templates** tab, and click **Upload**. The **Upload Template** pane displays.
4. Enter a name for the template in the **Name** field.
5. Click **Choose File**, and select the file to upload.
6. Click **Upload**.

### Uploading a template during deployment

While creating a deployment following the [steps below](#deploying-a-stack-template), select the **Upload File** option, and upload the template you wish to use for the deployment.

## Viewing a template

Access a read-only version of the template to view. To download an editable version of a template, see the [instructions below](#downloading-a-template).

### Viewing a template available to all Tenants

1. From the DuploCloud Portal, navigate to **Administrator** -> **System Settings**.
2. Select the **Templates** tab.
3. In the row of the template you want to view, click the menu icon (<img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FSPCkhta607SdqkjoRM96%2Fmenu%20icon.png?alt=media&#x26;token=545bc01a-58a7-4c8b-b7e5-b05244aca2e5" alt="" data-size="line">), and sele**ct View**.

### Viewing a template uploaded to a specific Tenant

1. Select the Tenant that will use the template from the **Tenant** list box.
2. Navigate to **Automation** -> **Stacks**.
3. In the row of the template you want to view, click the menu icon (<img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FSPCkhta607SdqkjoRM96%2Fmenu%20icon.png?alt=media&#x26;token=545bc01a-58a7-4c8b-b7e5-b05244aca2e5" alt="" data-size="line">), and select **View**.

## Downloading a template

### Downloading a template available to all Tenants

1. From the DuploCloud Portal, navigate to **Administrator** -> **System Settings**.
2. Select the **Templates** tab.
3. In the row of the template you want to Download, click the menu icon (<img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FSPCkhta607SdqkjoRM96%2Fmenu%20icon.png?alt=media&#x26;token=545bc01a-58a7-4c8b-b7e5-b05244aca2e5" alt="" data-size="line">), and select **Download**.

### Downloading a template uploaded to a specific Tenant

1. Select the Tenant that will use the template from the **Tenant** list box.
2. Navigate to **Automation** -> **Stacks**.
3. In the row of the template you want to Download, click the menu icon (<img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FSPCkhta607SdqkjoRM96%2Fmenu%20icon.png?alt=media&#x26;token=545bc01a-58a7-4c8b-b7e5-b05244aca2e5" alt="" data-size="line">), and select **Download**.

## Deleting a template

### Deleting a template available to all Tenants

1. From the DuploCloud Portal, navigate to **Administrator** -> **System Settings**.
2. Select the **Templates** tab.
3. In the row of the template you want to delete, click the menu icon (<img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FSPCkhta607SdqkjoRM96%2Fmenu%20icon.png?alt=media&#x26;token=545bc01a-58a7-4c8b-b7e5-b05244aca2e5" alt="" data-size="line">), and select **Delete**.

### Deleting a template uploaded to a specific Tenant

1. Select the Tenant that will use the template from the **Tenant** list box.
2. Navigate to **Automation** -> **Stacks**.
3. In the row of the template you want to delete, click the menu icon (<img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FSPCkhta607SdqkjoRM96%2Fmenu%20icon.png?alt=media&#x26;token=545bc01a-58a7-4c8b-b7e5-b05244aca2e5" alt="" data-size="line">), and select **Delete**.

## Deploying a Stacks template

1. Select the Tenant from the **Tenant** list box.
2. Navigate to **Automation** -> **Stacks**.
3. Select the **Deployments** tab.
4. Click **Deploy**. The **Deploy Template** pane displays.
5. Enter a deployment name in the **Name** field.
6. Select how you will provide a template:
   * **Upload File**: Click **Choose File** and select the file to upload.
   * **Select Template**: From the **Deploy Template** list box, select the template to deploy.
7. Click **Next**.
8. If a dialog box displays, enter values for any necessary input variables, and click **Next**.
9. Click **Deploy**. Resources from the selected template are deployed into the selected Tenant.

## Viewing Stacks deployments

View a deployment's logs or configurations (in JSON).

1. Select the Tenant from the **Tenant** list box.
2. Navigate to **Automation** -> **Stacks**.
3. Select the **Deployments** tab.
4. Click on the deployment you want to view in the **NAME** column. Details for the selected deployment display.
5. On the left is a list of **Resources** organized hierarchically. Select the resource(s) you want to investigate.
6. On the right, details for the selected resource(s) display. Select **JSON** or **Logs** to inspect specific configurations or logs for that resource.
7. Click **Close** to return to the **Deployments** tab.
