Optional Configuration Modules

Network topology could refer to additional configuration modules that can be used to deploy routing protocols or network services in addition to initial device configuration.

Module-specific parameters can be added to:

  • Node or link objects

  • Topology

  • defaults element in the topology, topology defaults, or global defaults.

Notes:

  • Global module parameters will be merged with node-specific parameters (see merging default values for details).

  • Link-level module parameters will be copied into interface data.

  • Merging of node-level and interface-level parameters is performed in configuration templates.

  • No further processing is performed on module-specific data when expanding network topology.

Specifying Configuration Modules

  • The default configuration modules used in a network topology are specified in module top-level element, for example:

module: [ ospf ]
  • The global list of configuration modules is inherited by all nodes in the network topology. You could change per-node list of configuration modules with the node-specific module element.

Example

Given the following topology…

module: [ ospf ]
nodes:
- name: c_nxos
  device: nxos
  module: [ ospf, bgp ]
- name: c_csr
  device: csr
- name: j_vsrx
  device: vsrx
  module: []

… OSPF and BGP will be configured on c_nxos, OSPF will be configured on c_csr and no extra configuration will be performed on j_vsrx.

Using Modules when Deploying Device Configurations

During the initial device configuration, the initial-config.ansible playbook generates and deploys configuration snippets for every module specified on individual network devices.

Notes:

  • The configuration snippets are created from templates in the templates/module directory.

  • The device-specific template is selected based on ansible_network_os value. For example, templates/ospf/eos.j2 will be used to create OSPF configuration for an Arista EOS device.

For more information, see list of configuration modules

Merging Default Values

Module parameters are always a dictionary of values stored under the module-name key in defaults, topology, node or link. Link module parameters are not changed during the topology expansion, node module parameters are adjusted based on topology parameters and defaults:

  • Global and topology defaults are merged with the defaults setting in topology file (see topology defaults and merging defaults)

  • For every module used in network topology, the default module parameters are merged with topology-level settings.

  • For every node, the topology-level settings for modules used by that node are merged with the node-level settings.

  • Final node-level settings are saved into expanded topology file or Ansible inventory, and used by configuration templates.

Example

The module parameter defaults will be illustrated with the following OSPF+BGP topology. The topology uses defaults element for simplicity reasons; you could specify the same parameters in topology- or global defaults.

defaults:
  device: iosv
  ospf:
    area: 0.0.0.0
    process: 2
  bgp:
    as: 65000

module: [ ospf ]
ospf:
  process: 1

nodes:
  r1:
    ospf:
      id: 17
      area: 0.0.0.1
  r2:
    module: [ bgp,evpn ]

Before the merge process starts, the global list of modules is augmented with node-specific modules, resulting in:

module: [ ospf,bgp,evpn ]

For every module used in network topology, the default values are added to global parameter values, resulting in:

ospf:
  area: 0.0.0.0
  process: 1
bgp:
  as: 65000

Notes:

  • OSPF area is taken from defaults;

  • OSPF process ID is specified as a global parameter and is not overwritten with a default value;

  • Even though there was no global BGP setting, it’s copied from the defaults.

Finally, the global settings are merged with node settings, resulting in:

nodes:
  r1:
    ospf:
      area: 0.0.0.1
      id: 17
      process: 1
  r2:
    bgp:
      as: 65000

Notes:

  • OSPF area was specified for R1, and is not replaced.

  • OSPF process ID was not specified for R1. It’s copied from the global OSPF parameters.

  • OSPF router ID was specified for R1, but not in global parameters. It’s not changed.

  • R2 had no BGP parameters. BGP parameters were copied from global BGP parameters.