Templates overview
Templates are used to generate configuration. In this article we shall learn below topics.
- How to create template
- How to use template in Jobs
- How to create multi-vendor template
Templates are accessed as below:
(1) Build -> Templates -> Templates edit (2) Select the client type(in this case CMDB)
There are three types of configuration templates.
Main Templates : Group of sub templates, linked to the node model
Sub Templates : Used to generate partial configurations (Ex, acl, snmp, syslog, ntp ..)
Port Templates. : Used to generate port configurations.
How to create template
In this example we would be generating L2 Vlan configuration for Cisco IOS and Junos nodes using templates.
Sample Config:
For Cisco IOS:
vlan 32
name test_vlan
For Junos:
set vlans test_vlan vlan-id 32
Building Template text
We will be separating the values like vlan_id, vlan_name and replace them with variable names(enclosed with <>).
The template text
For Cisco IOS:
vlan <Vlan_id>
name <Vlan_name>
For JunOS:
set vlans <Vlan_name> vlan-id <Vlan_id>
Creating Templates
(1) Build -> Templates -> Templates edit -> (2) Select the client type(In this case CMDB) -> (3) Sub Templates -> (4) New -> (5) Template name: L2_vlan -> (6) Vendor: Cisco_IOS -> Save
Under Revisions ->(1) Template:L2_Vlan -> (2) Edit -> (3) Paste the template text derived from previous section for Cisco_IOS -> (4) Change the Template status: Production -> Save
Similarly creating L2_Vlan template for Junos (Note that it is same name).
(1) New -> (2) Template:L2_Vlan -> (3) Vendor_type:Junos -> Save
Under Revisions ->(1) Template:L2_Vlan -> (2) Edit -> (3) Paste the template text derived from previous section for Junos -> (4) Change the Template status: Production -> Save
How to use template in Jobs
Templates names are enclosed within curly braces'{..}' while using in Commands box.
Creating new job for L2 vlan creation.
(1) Operate -> New Jobs-> Select the Job based on the node type(In this case Cmdb Jobs) -> (2) Select some nodename(in this case campus001-dist-b01 and junos1) -> (3) Next
(1) Commands: {L2_vlan} -> (2) -> Under Scenario:[Parameters] Vlan_id=32 Vlan_name=test_vlan -> (3) Save Job As: L2 Vlan Template -> (4) Save -> (5) Select all -> (6) Evaluate
Evaluate would show the results for the selected node from top. In this case campus-core01.
Click on Back to goback to the previous screen
Unselect campus-core01 (thus selecting only junos1)
Click on Evaluate to see the config results for junos1. Click Back to goback to the previous page
In order to execute the Job, click on (1) Schedule and then the window((2) Now or specific time)
Thus we can see how a same job would generate respective configurations for each of the different vendor nodes.
Refer to article Conditionals for advanced options in templates
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article