Chapter 6 CLI Tips, Techniques, and Shortcuts

Wildcards, Templates, and Aliases

The two primary steps in working with templates are creating templates and applying templates. The following procedure describes how to create a configuration template.

SUMMARY STEPS

1.configure

2.template template-name [($parameter $parameter...)] [config-commands]

3.Enter the template commands.

4.end-template

5.commit

6.show running-config template template-name

DETAILED STEPS

 

Command or Action

Purpose

Step 1

 

 

configure

Enters global configuration mode.

 

Example:

 

 

Router# configure

 

 

 

 

Step 2

template template-name [($parameter

Enters template configuration mode and creates a template.

 

$parameter...)] [config-commands]

template-name: Unique name for the template to be

 

 

 

Example:

applied to the running configuration.

 

parameter: (Optional) Actual values of the variables

 

RP/0/RP0/CPU0:router(config)# template tmplt_1

 

specified in the template definition. Up to five

 

 

 

 

parameters can be specified within parentheses. Each

 

 

parameter must begin with the $ character. Templates

 

 

can be created with or without parameters.

 

 

config-commands: (Optional) Global configuration

 

 

commands to be added to the template definition. Any

 

 

name in a command (such as the server name, group

 

 

name, and so on) can be parameterized. This means that

 

 

those parameters can be used in the template commands

 

 

(starting with $) and replaced with real arguments when

 

 

applied.

 

 

To remove the template, use the no form of this

 

 

command.

Step 3

 

 

Enter the template commands.

Defines the template commands.

 

Example:

 

 

RP/0/RP0/CPU0:router(config-TPL)# hostname test

 

Step 4

 

 

end-template

Ends the template definition session and exits template

 

 

configuration mode.

 

Example:

When you end the template session, you are returned to

 

RP/0/RP0/CPU0:router(config-TPL)# end-template

global configuration mode.

 

 

 

 

 

Cisco IOS XR Getting Started Guide

 

 

 

 

 

 

OL-10957-02

 

 

6-13

 

 

 

 

 

Page 169
Image 169
Cisco Systems Cisco IOS XR manual End-template, Show running-config template template-name