How to use configuration template in Jobs

How to use configuration template in Jobs

Templates overview

Templates are used to generate configuration.  In this article we shall learn below topics.
  1. How to create template
  2. How to use template in Jobs
  3. 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 statusProduction -> 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

    • Related Articles

    • Triggering jobs from events through syslog

      Overview We can trigger netyce jobs from syslog messages. The event manager(SEC) can be used to match the syslog message pattern to trigger the suitable job.. The events on the device can be like config change, port/neighbor flap etc. Below is an ...
    • How to supply parameters for the Job

      There are multiple ways we can supply values to the job.  Here we learn couple of ways to do it: Parameters under Scenario Retrieving values from the database Parameters under Scenario To understand this example, we are using a L2 Vlan configuration ...
    • Parsing values from the commands

      Parsing purpose Parsing deals with extracting interested part of information from the specific text.  The text can be command output(Command parsing) or from device configuration(Config parsing). In this article we are dealing with Command parsing. ...
    • Building parsing templates

      What is parsing Parsing deals with extracting interested part of information from the specific group of text.  It can be command output(Command parsing) or from device configuration(Config parsing). How to access parsing tool Building -> Templates -> ...
    • How to run Basic command Job

      Introduction Basic command Jobs are basically used to automate day to day jobs. This article is about executing our first job, with minimal information.  Below are the 5 steps involved. Select the Node Load the Job Define the config commands to ...