Device Group
Device groups provide a powerful mechanism for applying consistent configurations across multiple devices. They sit in the middle of the configuration hierarchy (Global → Device Group → Device), allowing you to define common settings that can be inherited by member devices while still permitting device-specific overrides.
Device groups are particularly effective for:
- Role-based configuration: Grouping devices by function (access switches, core routers, etc.)
- Location-based configuration: Applying site-specific settings to devices in the same location
- Service deployment: Rolling out consistent service configurations across multiple devices
- Staged rollouts: Gradually applying configuration changes to device subsets
Device membership can be defined in two ways:
- From the device: Devices can specify which groups they belong to via the
device_groupsattribute - From the group: Groups can specify their member devices via the
devicesattribute
Device groups support variables, configuration templates, and full device configurations, providing flexibility in how you structure and deploy your network policies.
Diagram
Section titled “Diagram”Classes
Section titled “Classes”device_groups (iosxr)
Section titled “device_groups (iosxr)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| name | String | Yes | ||
| version | String | No | ||
| platform | Choice | NCS, C8000, XRV9K, XRd | No | |
| devices | List | String | No | |
| variables | Map | No | ||
| templates | List | String | No |
Examples
Section titled “Examples”iosxr: device_groups: # Basic group with member devices defined in group - name: CORE_ROUTERS devices: - Core-Router-01 - Core-Router-02 - Core-Router-03 configuration: router_ospf: - process_name: "OSPF1" mpls_ldp_sync: false hello_interval: 10 dead_interval: 40 priority: 10
# Group with variables and configuration templates - name: CORE_ROUTERS variables: ospf_area: "0" configuration_templates: [ospf_core] configuration: ssh: server_dscp: 48 server_logging: true server_rate_limit: 60 server_session_limit: 10 server_v2: true
# Location-based group - name: BUILDING_A_DEVICES devices: [Core-Router-A1, Access-Router-A1, Access-Router-A2] variables: location: "Building A" dns_server: "192.168.100.10" configuration: domain: name: "cisco.com" name_servers: - address: ["${dns_server}"] order: 1 ntp: ipv4_peers_servers: - address: "192.168.1.100" type: "server"
# Alternative: Define group membership from devices devices: - name: Core-Router-01 host: 10.10.10.1 device_groups: - CORE_ROUTERS