HomeGuidesAPI Reference
GuidesAPI ReferenceGitHubAirheads Developer CommunityLog In
Guides

Incremental Changes

Incremental configuration updates

Once a device is connected to Central and provisioned, we consider any subsequent configuration modification to that device an incremental change.

Depending on the device's orientation in the Central environment (i.e. what group, template, and/or variables are associated with the device), this can be done by mixing and matching the following operations, whichever are required:

  • Updating the device variables
  • Updating a template to a group
  • Moving the device to another group

Workflow Prerequisites

  1. Devices on-line in Central and configured by way of template groups, templates, and variables

Updating Device Variables

If the device is in the appropriate group with the appropriate template, and all that would be required to update the configuration is adding, modifying, or removing variables, you would be best served by to do so by creating a task that uses the central_variables module and specifies the replace_all action:

- name: Update all template variables for one or multiple devices using a JSON file   
  central_variables:
    action: replace_all
    local_file_path: /home/admin/variables.json

A recommended approach is to use either the get or get_all actions to retrieve the existing variables for the device(s), and then to modify that information as necessary. The newly modified variables file should be in JSON format.

🚧

The behavior of the replace_all action is such that for any device specified in the variables file, its entire set of variables is replaced by the set specified in the JSON data. This means that any variables that are currently defined for a device in Central but aren't defined for it in the incoming variables file will be erased. For devices that aren't included in the variables file, their variables remain untouched.

📘

You can also use the update_all action if you are only adding new variables or updating the values of existing variables. The update_all action is a purely additive operation; in the new variables file being uploaded, any variables not currently defined for the device in Central are created, and any variables currently existing in Central have their values updated as specified. Omitted variables are not affected.

Updating a Template

If the device is in the appropriate group with an applicable template, and all that would be required to update the configuration is modifying the template, you would be best served by to do so by creating a task that uses the central_templates module and specifies the update action:

- name: Replace the template for a given device type 
    central_templates:
      action: update
      group_name: new-group
      template_name: aos-sw-temp
      device_type: ArubaSwitch
      version: ALL
      model: ALL
      local_file_path: /home/admin/sw_template.txt

Note that, it is quite possible that the updated template contains new variables that aren't defined for one or multiple applicable devices. In this case, you would also need to create a task to add those variables. For example, you could copy the central_variables task with the replace_all action as outlined above.

Moving a Device

Assuming that the group to which the device will be moved contains an applicable template and that the variables required for that template are defined for the device, you can move the device to the new group and have it immediately take on the configuration generated by that combination of template and variables.

If this is not the case, you would need to create/update a template in that group and/or update the device's variables before moving the device over. You would do so by following the operations listed above and/or on the Deploying Devices page.

The following is an example task to move two devices from one group to another group:

- name: Move devices to a group
      central_devices:
        action: move_devices
        group_name: new-group
        device_serial_list:
          - CNXXXXXXXX
          - CNXXXXXXYY

A Final Word

As covered at the outset of this page, any step(s) required to perform an incremental configuration update for devices depends on the current arrangement of groups, templates, and variables in Central.

With that said, the salient takeaway remains the same as discussed in the conclusion of the Deploying Devices page, namely that in order for a device to receive the desired configuration, the following conditions must be met:

  1. a template group for the device type (i.e. wired or wireless) exists
  • the template group contains a template applicable to the device
  • the device has variables associated with it
  • the device is situated in the template group

This fundamental tenet can be used as a guiding principle when it comes to implementing both the initial provisioning and the incremental updates workflows. Happy automating!