- 18 Oct 2024
-
DarkLight
-
PDF
Software Upgrade (IOS) - Command Templates
- Updated on 18 Oct 2024
-
DarkLight
-
PDF
Command templates allow users to apply CLI knowledge and skills as part of their automation strategy. Here we will build a simple template that will run the show boot command against our IOS device and to determine the current boot version. Multiple steps in the Software Upgrade – IOS Pre-Built workflow we will use today are Command Templates, so this exercise will give you a better idea of how that workflow operates.
Command Templates Video
Step 1
From the Itential Automation Dashboard, click Automation Studio in the left navigation panel.
Step 2
Click the + icon at the top of the left navigation panel.
Step 3
The Create window opens. Click the dropdown menu and select Command Template.
Step 4
Name the template, Template - XX, where XX represents your initials, and click CREATE.
Step 5
The Command Template window opens and we are ready to enter the first command. On the right-hand side of the Command #1 box you’ll find the rules section. Here the user can define the rule logic associated with the command they’ve entered in the left-hand box. We expect our command show boot to confirm the correct version is there, so in this case, we will select contains in our rules dropdown.
Step 6
In the Command #1 box, enter show boot. In the Rules box, enter the boot version (17.03.04 or 17.03.05) noted per the results of the show configuration conducted in the previous module.
Next, we will select a target device. In the device search box, enter IOS and press enter. Select the IOS option that appears in blue directly below to select our target device for this Command Template.
Step 7
We are ready to test. Click TEST ALL COMMANDS.
Step 8
The results appear at the bottom. Notice our template passed and there is a green check mark next to the rule.
Step 9
This first version of the template we built used a static value for the port. While this is great for testing a template as it is built, ideally we want the template to be more flexible when implemented as part of a workflow. To do this, we’ll introduce variables to our template.
For Command #1 that we just created, we will modify the rule slightly. We will replace 17.03.05 with <!version!>. The <! !> denotes a new variable within a Command Template. In this case, we are variablizing the boot version.
Step 10
An Enter Values prompt displays. Enter the boot version (17.03.04 or 17.03.05) noted per the results of the show configuration conducted in the previous module.
Step 11
Click Submit.
Step 12
As expected, the Command Template passed. The results of the command template can be seen directly below in the Test Results box and there is a green check mark next to the rule. Review the results box.