Skip to content

rConfig - Snippets

1 mins V7 Pro

Snippets are short configurations that can be used to configure your devices either individually or in bulk. They are a great way to save time and ensure that your configurations are consistent across your devices.

From V7, we have add some new features to snippets. First, you can send a snippet to a device, from the devices page. This is a great way to test a configuration on a single device, before sending it to all devices. Second, roles are applied to snippets. This means that you can control who can see and use snippets, and who can edit and delete them. Last, you can parameterize snippets. This means that you can add variables to your snippets, and then use them in your configurations.

Introducing Seamless SSO: rConfig's New Okta Integration!

Check out the tutorial video above.

Adding/ Editing Vendors

From the main Snippets view, click New Snippet to add a new snippet, or click the edit button in the table.

Snippets Main View

The snippet form itself is very simple. You can add a snippet name, and a description for the snippet, and then add the snippet configuration. The snippet configuration is a free text field. Add lines as if you were manually typing in the configuration i.e. include ‘conf t’ to start a new configuration section, if on Cisco devices. You will notice the roles options at the bottom of the form. This is where you can apply roles to the snippet. Roles are retired from the main roles view. Simply, if you account is a member of the role, you can see the snippet. The system-wide default ‘admin’ role is applied to all snippets by default, and this cannot be removed.

You may also adjust roles for snippets from the main table. See screenshot below.

Snippets Role Assign

Parameterized Snippets

You can now add arbitrary variables to your snippets, making them more flexible. For example, you can add a variable for the hostname of a device and use that variable in your configuration. To add a variable, simply include the variable name in the format {variable_name} within your snippet. When you send the snippet to a device, you will be prompted to enter the value for the variable, which will then be used in your configuration.

Parameterized snippets

Send snippets to individual devices

You can send individual snippets to devices from the devices page. Simply click the ‘Send Snippet’ button on the device row, and select the snippet you want to send. You will be prompted to enter the value for any variables in the snippet, if the snippet is parameterized.

Select snippet snippets

Select your parameters and click ‘Send Snippet’. The snippet will be sent to the device, and you will be redirected to the device page. You can see the output of the snippet in the devices configs table. See section below for more information on parameterized snippets.

Select snippet snippets

Sending snippets in bulk

The most effective way to send snippets in bulk to hundreds or thousands of devices is through a scheduled task. You can create a task of type ‘Send Snippet’ and select the snippet you want to send. Next, choose the devices, Command Groups, or tags to which the snippet will be sent. It is recommended to set the snippet schedule to an appropriate interval, such as once a year, for one-time tasks like updating device firmware. Once the task is manually run, you can delete it if it is no longer needed.

Snippets parameters and instuctions

Parameters

As of 7.0.5 you can add paramters to snippets. Parameters allow you to add variables to your snippets, that can be used later when sending the snippet to a device. To add a parameter simpley add a parameter name in the format of {parameter_name} to your snippet. The paramter then can be used in your configuration when sending the snippet to individual devices.

Example parameterized snippet

Terminal window
conf t
interface {Interface ID}/{Port}
desc {Enter a Description}
switchport access {VLAN ID}
end
do wr mem
Send Parameterized snippet from device page.

As you can see from the screenshot, when you parameterize your snippet, you will be prompted to enter the value for the parameter.

Instructions

As of 7.0.9 you can add instructions to snippets. This means, you can alter the order of operations in your snippet configuration. This is useful if you need to slow down, or speed up certain steps in your configuration.

The first supported instructions are sleep and config_prompt. Instructions must be entered in the format of #[instruction_name instruction_value].

Sleep

The sleep instruction allows you to pause the snippet for a specified number of seconds, and mutliple times if required. Example:

Config Prompt

The config_prompt instruction allows you to change the prompt of the device when in config mode. This will help speed up your configuration deployment as the devices main prompt as configured in device settings is not always correct when entering config mode on network devices. This instruction gives your more felxibility. The instruction must be entered in the format of #[config_prompt new_prompt].

Please note some special characters are escaped in the prompt automatically. Those are (, ), and single and double quotes. Regexp wildcards are allowed in the prompt, such as .*.

Troubleshooting Snippets

If any issues are encountered with sending snippets to devices, similar to device debugging, you can run the following command to update view snippet delivery in real time. This bypassess the queue, and gives us far greater insight into what is happening with the snippet delivery.

pa rconfig:send-snippet snippet_id device_id

The output from this command is similar to the output from the device debugging command, and should be used to troubleshoot issues with sending snippets to devices. Any advanced or complex issues should be raised on the rConfig support center as a ticket.

Role based access to Snippets

As of V7.0.8 there is a new feature to allow role based access to snippets. This feature is enabled by default, and the system admin role has access to all snippets. This is hardcoded and cannot be changed.

Troubleshooting Snippet RBAC

If any issues are encountered with the device RBAC feature, you can run the following command to update the device roles to Update all devices to ensure they at least have admin have roles attached to them.

php artisan rconfig:update-snippet-roles