Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Device variables can be defined for device(s) in the "Devices" screen. You will find a "Variables" button here, which opens the variable edit window.

Please note the The Variable edit window has 2 separate modes:

...

In this mode, you can set variables for the specific device which was selected when you opened the variable edit window. You can simple simply specify variables in a "key=value" format. If any variables are already present on the device, they will be loaded into the edit window for you. Here is an example of how variable configuration on a single device would look like:

...

The above configuration would set 3 variables for the selected device, "foo", "variable_name" and "hostname". When saving variables, omitting any existing variables remove removes those variables. To simplify - when you save variables for a device, all existing variables will be removed, and then variables will be set to the device as provided in the edit window.

...

As mentioned in a previous section, if you open the variable edit window without any devices selected, it will be in an empty bulk-edit mode. Please note you You don't need to manually write out the device sections.You can select multiple devices in the Device table, and open the variable edit window to have the devices pre-filled for you, including their existing variables.

...

Variables can be used in Config Push Commands , to substitute unique per-device values when commands are being pushed to devices. This allows you to create a single Push Preset which can send unique commands to each device, or allow for unique per-device values to be inserted inside commands. Variables can be referred to in Config Push in the following format: "${variable_name}".

 

Here is an example which would utilize a variable with name "snmp_community" to create an SNMPv2 community on MikroTik RouterOS:

Code Block
languagetext
/snmp community
add security=none write-access=no name=${snmp_community}

 

Alternatively, here is an example of creating a user on Cisco IOS, where the password for the user is read from a device variable:

Code Block
languagetext
! simple user creation
username network-admin password ${admin-password}

! privileged user creation
username network-admin privilege 15 password ${admin-password}

Variable substitution and the "\" escape character

If you wish to send a sequence beginning with "${" to the device, you can escape the variable declaration like this:

Code Block
languagetext
/interface bridge
add name=lo1 comment="This is a comment with \${some strange characters}"

In the example above, Unimus would not substitute the text above for a variable's value. The comment for the loopback interface would be set to "This is a comment with ${some strange characters}".

Variable chaining and Push Behavior Modifiers

Variables chaining is NOT supported. In other words, you can NOT refer to other variables from within different variables. Config Push Behavior Modifiers however CAN be declared inside variables.

Code Block
languagetext
# this is NOT possible
var1=value
var2=some_other_${var1}