- Itential Cloud
- Release Announcements
- Admin Portal
- Automation Service
- Getting Started
- Automation Service Guides
- Releases & Highlights
- Itential Automation Gateway 5 (IAG5)
- What's New
- Intro to IAG5
- Installation
- Scalable Designs
- Creating a Service
- Decorators
- Using IAG5
- Command References
- Config Variables
- FAQ & Support
- Itential Platform (2023.2)
- Orchestration Environments
- Admin Essentials
- API Documentation
- Studio
- Navigation & User Interface
- Automation Builder
- Intro to Automation Builder
- New Canvas Experience
- How to Create and Run Workflows on the Canvas
- How to Configure Tasks on the Canvas
- How to Modify Tasks on the Canvas
- How to Use Transitions and Task States on the Canvas
- Parallel Branching on the Canvas
- Troubleshooting Errors and Warnings on the New Canvas
- Keyboard Shortcuts for the Canvas
- How to Use Search in the New Canvas
- How to Use the Reference View
- Gen 1 Automation Builder Canvas
- Projects
- Forms
- JSON Forms
- Template Builder
- Command Templates
- Analytic Templates
- Task References
- Transformations
- Configuration Manager
- Integrations & Adapters
- Legacy & Custom
- Lifecycle Manager
- Operations Manager
- Using NSO with Itential Cloud
- Breaking Changes
- Broken References
- Data Path Property Renamed
- DryRun & View DryRun Manual Tasks Removed
- Help and Status API Endpoints Removed
- IAP Key Removed
- Integration API Routes Removed
- Job Variable Changes in Child Workflows
- IWAN Tasks Removed
- NSO Features Removed
- Merge Task Variables - Null vs. Undefined
- Operations Manager API Changes
- Removed Inline Images from Pre-built Automation README Files
- Reserved Method Output Name
- Seed Scripts Removed in Template Builder
- Service Manager UI Removed
- Workflow Engine API Routes Removed
- Itential Platform (2023.1)
- Orchestration Environments
- Admin Essentials
- API Documentation
- Automation Studio
- Navigation & User Interface
- Automation Builder in IAP
- Intro to Automation Builder
- Gen 1 Automation Builder
- New Canvas Experience in Automation Builder
- How to Create and Run Workflows on the Canvas
- How to Configure and Edit Tasks on the Canvas
- How to Use Transitions and Task States on the Canvas
- How to Use Search in the New Canvas
- How to Use the Reference View
- Parallel Branching on the Canvas
- Troubleshooting Errors and Warnings on the New Canvas
- Keyboard Shortcuts for the Canvas
- Forms
- JSON Forms
- Template Builder
- Analytic Templates
- Command Templates
- Task References
- Transformations
- Configuration Manager
- Integrations & Adapters
- Legacy & Custom
- Lifecycle Manager
- Operations Manager
- Using NSO with IAP
- Itential Cloud Use Case Walk-Throughs
- QuickStart Automation Use Cases
- Asset Reservation
- Itential Cloud Use Case Walk-Through - Port/VLAN Configuration (IOS) 2023.1
- Port/VLAN Configuration (IOS) - Overview
- Port/VLAN Configuration (IOS) - Device Configuration
- Port/VLAN Configuration (IOS) - Command Templates
- Port/VLAN Configuration (IOS) - JSON Form
- Port/VLAN Configuration (IOS) - Transformations
- Port/VLAN Configuration (IOS) - Pre-Built
- Port/VLAN Configuration (IOS) - Workflow
- Port/VLAN Configuration (IOS) - Operations Manager
- Port/VLAN Configuration (IOS) - Configuration Manager
- Port/VLAN Configuration (IOS) - Summary
- Itential Cloud Use Case Walk-Through - Port/VLAN Configuration (EOS) 2023.1
- Port/VLAN Configuration (EOS) - Overview
- Port/VLAN Configuration (EOS) - Device Configuration
- Port/VLAN Configuration (EOS) - Command Templates
- Port/VLAN Configuration (EOS) - JSON Form
- Port/VLAN Configuration (EOS) - Transformations
- Port/VLAN Configuration (EOS) - Pre-Built
- Port/VLAN Configuration (EOS) - Workflow
- Port/VLAN Configuration (EOS) - Operations Manager
- Port/VLAN Configuration (EOS) - Configuration Manager
- Port/VLAN Configuration (EOS) - Summary
- Itential Cloud Use Case Walk-Through - Create a Security Rule (Panorama) 2023.1
- Itential Cloud Use Case Walk-Through - Create Pool and Virtual Server (Big-IP) 2023.1
- Create Pool & Virtual Server (BIG-IP) - Overview
- Create Pool & Virtual Server (BIG-IP) - JSON Forms
- Create Pool & Virtual Server (BIG-IP) - Transformations
- Create Pool & Virtual Server (BIG-IP) - Workflow
- Create Pool & Virtual Server (BIG-IP) - Operations Manager
- Create Pool & Virtual Server (BIG-IP) - Summary (2023.1)
- Itential Cloud Use Case Walk-Through - Create and Update Change Request (ServiceNow)
- Create and Update Change Request (ServiceNow) - Overview
- Create and Update Change Request (ServiceNow) - Jinja2 Template
- Create and Update Change Request (ServiceNow) - JSON Form
- Create and Update Change Request (ServiceNow) - Transformation
- Create and Update Change Request (ServiceNow) - Workflow
- Create and Update Change Request (ServiceNow) - Operations Manager
- Create and Update Change Request (ServiceNow) - Summary
- Itential Cloud Use Case Walk-Through - Create and Update Incident (ServiceNow)
- Create and Update Incident (ServiceNow) - Overview
- Create and Update Incident (ServiceNow) - Configuration Manager
- Create and Update Incident (ServiceNow) - Jinja2 Templates
- Create and Update Incident (ServiceNow) - JSON Forms
- Create and Update Incident (ServiceNow) - Transformations
- Create and Update Incident (ServiceNow) - Workflow
- Create and Update Incident (ServiceNow) - Operations Manager
- Create and Update Incident (ServiceNow) - Summary
- Itential Cloud Use Case Walk-Through - Golden Configuration (IOS)
- Itential Cloud Use Case Walk-Through - Provision VPC & EC2 (AWS)
- Provision VPC and EC2 Instance (AWS) - Overview
- Provision VPC and EC2 Instance (AWS) - Transformation
- Provision VPC and EC2 Instance (AWS) - Pre-Built Workflows
- Provision VPC and EC2 Instance (AWS) - JSON Form
- Provision VPC and EC2 Instance (AWS) - Workflow
- Provision VPC and EC2 Instance (AWS) - Operations Manager
- Provision VPC and EC2 Instance (AWS) - Clean Up
- Provision VPC and EC2 Instance (AWS) - Summary
- Itential Cloud Use Case Walk-Through - Software Upgrade (IOS)
- Software Upgrade (IOS) - Overview
- Software Upgrade (IOS) - Device Configuration
- Software Upgrade (IOS) - Command Templates
- Software Upgrade (IOS) - JSON Form
- Software Upgrade (IOS) - Transformation
- Software Upgrade (IOS) - Workflow
- Software Upgrade (IOS) - Operations Manager
- Software Upgrade (IOS) - Configuration Manager
- Software Upgrade (IOS) - Summary
- Itential Cloud Use Case Walk-Through - Software Upgrade (EOS)
- Software Upgrade (EOS) - Overview
- Software Upgrade (EOS) - Device Configuration
- Software Upgrade (EOS) - Command Templates
- Software Upgrade (EOS) - JSON Form
- Software Upgrade (EOS) - Transformation
- Software Upgrade (EOS) - Workflow
- Software Upgrade (EOS) - Operations Manager
- Software Upgrade (EOS) - Configuration Manager
- Software Upgrade (EOS) - Summary
- Itential Cloud Use Case Walk-Through - API Compliance (AWS)
- Itential Cloud Use Case Walk-Through - Bulk IP Address Allocation (Netbox)
- Bulk IP Address Allocation (Netbox) - Overview
- Bulk IP Address Allocation (Netbox) - Jinja2 Template
- Bulk IP Address Allocation (Netbox) - Pre-Built Workflow
- Bulk IP Address Allocation (Netbox) - JSON Form
- Bulk IP Address Allocation (Netbox) - Workflow
- Bulk IP Address Allocation (Netbox) - Operations Manager
- Bulk IP Address Allocation (Netbox) - Transformation
- Bulk IP Address Allocation (Netbox) - Workflow Modification
- Bulk IP Address Allocation (Netbox) - Operations Manager Part 2
- Bulk IP Address Allocation (Netbox) - Summary
- Itential Cloud Use Case Walk-Through - Cloud Managed Network (Meraki)
- Cloud Managed Network (Meraki) - Overview
- Cloud Managed Network (Meraki) - Pre-Built Installation
- Cloud Managed Network (Meraki) - JSON Forms
- Cloud Managed Network (Meraki) - Transformation
- Cloud Managed Network (Meraki) - Workflows
- Cloud Managed Network (Meraki) - Create an Automation
- Cloud Managed Network (Meraki) - Device Configuration
- Cloud Managed Network (Meraki) - Summary
- Itential Cloud Use Case Walk-Through - Assign Network & IP (Infoblox)
- Assign Network & IP (Infoblox) - Overview
- Assign Network & IP (Infoblox) - Pre-Built Resources
- Assign Network & IP (Infoblox) - JSON Form
- Assign Network & IP (Infoblox) - Transformation
- Assign Network & IP (Infoblox) - Workflow
- Assign Network & IP (Infoblox) - Operations Manager
- Assign Network & IP (Infoblox) - Summary
- Itential Cloud Use Case Walk-Through - Create a DNS A Record (Infoblox)
- Create a DNS A Record (Infoblox) - Overview
- Create a DNS A Record (Infoblox) - Jinja2 Templates
- Create a DNS A Record (Infoblox) - Pre-Builts
- Create a DNS A Record (Infoblox) - JSON Forms
- Create a DNS A Record (Infoblox) - Transformation
- Create a DNS A Record (Infoblox) - Workflows
- Create a DNS A Record (Infoblox) - Operations Manager
- Create a DNS A Record (Infoblox) - Summary
- Itential Cloud Use Case Walk-Through - Managing the Lifecycle of a Service (IOS)
- Managing the Lifecycle of a Service (IOS) - Overview
- Managing the Lifecycle of a Service (IOS) - Pre-Built Resources
- Managing the Lifecycle of a Service (IOS) - Configuration Manager (Part 1)
- Managing the Lifecycle of a Service (IOS) - Workflows
- Managing the Lifecycle of a Service (IOS) - Lifecycle Manager (Part 1)
- Managing the Lifecycle of a Service (IOS) - Configuration Manager (Part 2)
- Managing the Lifecycle of a Service (IOS) - Lifecycle Manager (Part 2)
- Managing the Lifecycle of a Service (IOS) - Summary
- Itential Cloud Use Case Walk-Through - Golden Configuration (IOS) 2023.1
- Itential Cloud Use Case Walk-Through - Create and Update Incident (ServiceNow) (2023.1)
- Create and Update Incident (ServiceNow) - Overview
- Create and Update Incident (ServiceNow) - Configuration Manager
- Create and Update Incident (ServiceNow) - Jinja2 Templates
- Create and Update Incident (ServiceNow) - JSON Forms
- Create and Update Incident (ServiceNow) - Transformations
- Create and Update Incident (ServiceNow) - Workflow
- Create and Update Incident (ServiceNow) - Operations Manager
- Create and Update Incident (ServiceNow) - Summary
- Itential Cloud Use Case Walk-Through - Create and Update Change Request (ServiceNow) 2023.1
- Create and Update Change Request (ServiceNow) - Overview
- Create and Update Change Request (ServiceNow) - Jinja2 Template
- Create and Update Change Request (ServiceNow) - JSON Form
- Create and Update Change Request (ServiceNow) - Transformation
- Create and Update Change Request (ServiceNow) - Workflow
- Create and Update Change Request (ServiceNow) - Operations Manager
- Create and Update Change Request (ServiceNow) - Summary
- 05 Dec 2024
-
DarkLight
-
PDF
Using Template Builder
- Updated on 05 Dec 2024
-
DarkLight
-
PDF
Templates in Workflows
Workflow execution can generate large quantities of information that may be extraneous to the task at hand. For example, when interacting with CLI-driven devices, workflows often draw extended responses in the form of command output. You may only care about a few key pieces of data from such output — port number, port status, VLAN, etc. Similar use cases are seen when calling API endpoints. It becomes important, then, to have some way to filter this data down to the essentials, especially if it is being fed into workable tasks later in your workflow. Templates fulfill this function in Itential Automation Platform (IAP).
A template is a static text file that contains, in its simplest form, placeholder variables to be dynamically populated by incoming data. The exact capabilities and syntax of a template depend on the template language used. IAP supports two template types:
- Jinja2
- TextFSM
When a template task, such as Apply Template, is inserted into a workflow, it receives information from a preceding workflow task or job variable and combines that information with a designated template. The template is populated, and the filtered information can then be used by subsequent tasks.
On this page, you will learn:
- How to create a template.
- How to use the Template Builder application to define a template.
- How to use defined templates in workflows.
Prerequisite Reading
Templates created in Template Builder use either the Jinja2 or TextFSM language. As such, knowledge of the relevant language is required before proceeding. For more information, refer to the official documentation for:
Creating and Opening Templates
Templates are created on the Automation Studio home page. To do this:
- Click the Create (
) button located at the top of the side navigation menu. The Create modal will appear.
- Select Template from the What would you like to create? drop-down menu.
- Enter the desired template name and group into the relevant text input fields.
- Select which language the template should use via the Type drop-down menu.
- Click the Create button at the bottom-left corner of the modal. Your new template will open in the Template Builder application.
Figure 1: Creating a New Template
To open a pre-existing template, simply select it from the Templates section of the side navigation menu. Alternatively, you can browse templates via the Automation Studio Collection view by clicking the Search () button located at the top of the side navigation menu.
Figure 2: Creating a New Template
To open a pre-existing template, simply select it from the Templates section of the side navigation menu. Alternatively, you can browse templates via the Automation Studio collection view by clicking the Search () button located at the top of the side navigation menu.
Template Builder UI
Whether you have created a new template or selected an existing one, it will open in the Template Builder application. This application is comprised of three main components, each referenced in the following table.
Label | Component | Function |
---|---|---|
1 | Data Field | To provide example data to be parsed by your template. |
2 | Template Field | To define your template. |
3 | Output Field | View what happens when your example data is combined with your template. The Output Field (response area) will update as you make modifications to your template. |
Figure 3: Template Builder UI
Defining Your Template
As you can see, the application UI is largely dominated by the Data, Template, and Output fields. Indeed, nearly the entirety of Template Builder's functionality is based on how these fields interact with each other. In general:
- Template logic is entered into the Template field (right). The syntax used varies depending on the language of the current template, which is decided during template creation via the Type drop-down menu.
- Example data is entered into the Data field (left). This field should mimic the data structures you intend to input to this template. For example, if your template is meant to parse a particular API response, you should provide an example of that response in this field. Keep the data type expected by your template language in mind: Jinja2 expects JSON data, TextFSM expects semi-formatted text, etc.
- The Data and Template fields are combined, populating the Output field (bottom) with the data structure that you can expect when using the template in your workflows. Changes made to the Data or Template fields are reflected here in real time.
In this way, Template Builder can be used to actively draft and troubleshoot templates for use in your workflows.
Figure 4: Jinja2 Template Evaluation
Example: Using Your Templates in Workflows
Your workflow retrieves a large number of interface entries from a network switch via API. Later on in the workflow, you would like to manually review which interfaces have a role of "voice". However, the JSON object returned by the API contains entries for dozens of interfaces; it's entirely possible that you may miss relevant entries in the noise.
To account for this, you decide to pass the API response through a Jinja2 template, filtering the results to only those entries which have a role of "voice". The filtered response is then queried and passed to the View Data task for confirmation.
In this example, the API response is simulated by the New Variable task. This task creates a new job variable, deviceResponse
, for later reference. Its contents are as follows:
{
"interfaces": {
"ethernet10": {
"role": "desktop",
"vlan": 1
},
"ethernet11": {
"role": "desktop",
"vlan": 1
},
"ethernet15": {
"role": "printer",
"vlan": 5
},
"ethernet22": {
"role": "voice",
"vlan": 10
},
"ethernet25": {
"role": "voice",
"vlan": 10
}
}
}
To do so:
- Add the Apply Template task to your workflow. Define the following input parameters:
- Set
text
to the location of your input data. In this scenario, thedeviceResponse
job variable. - Set
template
to the name of your template. In this scenario,DocsDemo
.
- Set
- Add the Query task to the workflow. Draw a success transition from Apply Template to Query. Define the following input parameters for Query:
- Set
object
to the Apply Template output object, theparsed
variable. - Set
query
to reference the relevant key of the selected object. In this scenario,results
.
- Set
- Add the View Data task to your workflow. Draw a success transition from Query to View Data. Define the following input parameters for View Data:
- Set
header
to "Voice Interfaces" andmessage
to "Ensure that the expected interfaces are designated as 'voice'," respectively. - Set
body
to reference the Query output object, thereturn_data
variable. - Set
btn_success
to "Accept" andbtn_failure
to "Reject," respectively.
- Set
- Draw a success transition from the View Data task to the end of your workflow.
Figure 5: Example Workflow
When working the View Data task in Operations Manager, you will be presented with the following modal shown below.
Figure 6: View Data Modal
The Apply Templates task works similarly to Apply Template; however, the text
and templates
fields of Apply Templates accept arrays of data. For example:
- Your
text
value may be an array consisting ofindex0
,index1
, andindex2
, while yourtemplates
value may be an array consisting oftemplate0
,template1
, andtemplate2
. - In this case,
index0
would be combined withtemplate0
,index1
withtemplate1
,index2
withtemplate2
, etc.