W3cubDocs

/Ansible

cl_interface - Configures a front panel port, loopback or management port on Cumulus Linux.

New in version 2.1.

Synopsis

Configures a front panel, sub-interface, SVI, management or loopback port on a Cumulus Linux switch. For bridge ports use the cl_bridge module. For bond ports use the cl_bond module. When configuring bridge related features like the “vid” option, please follow the guidelines for configuring “vlan aware” bridging. For more details review the Layer2 Interface Guide at http://docs.cumulusnetworks.com

Requirements (on host that executes module)

  • Alternate Debian network interface manager - ifupdown2 @ github.com/CumulusNetworks/ifupdown2

Options

parameter required default choices comments
addr_method
no
  • loopback
  • dhcp
Address method.
alias_name
no
Description of the port.
clagd_enable
no
Enables the clagd daemon. This command should only be applied to the clag peerlink interface.
clagd_peer_ip
no
IP address of the directly connected peer switch interface.
clagd_priority
no
Integer that changes the role the switch has in the clag domain. The lower priority switch will assume the primary role. The number can be between 0 and 65535.
clagd_sys_mac
no
Clagd system mac address. Recommended to use the range starting with 44:38:39:ff. Needs to be the same between 2 Clag switches.
ipv4
no
List of IPv4 addresses to configure on the interface. In the form X.X.X.X/YY.
ipv6
no
List of IPv6 addresses to configure on the interface. In the form X:X:X::X/YYY.
location
no [u'/etc/network/interfaces.d']
Interface directory location
mstpctl_bpduguard
no
Enables BPDU Guard on a port in vlan-aware mode.
mstpctl_portadminedge
no
Enables admin edge port.
mstpctl_portnetwork
no
Enables bridge assurance in vlan-aware mode.
mtu
no
Set MTU. Configure Jumbo Frame by setting MTU to 9000.
name
yes
Name of the interface.
pvid
no
In vlan-aware mode, defines vlan that is the untagged vlan.
speed
no
Set speed of the swp(front panel) or management(eth0) interface. speed is in MB.
vids
no
In vlan-aware mode, lists VLANs defined under the interface.
virtual_ip
no
Define IPv4 virtual IP used by the Cumulus Linux VRR feature.
virtual_mac
no
Define Ethernet mac associated with Cumulus Linux VRR feature.

Examples

# Options ['virtual_mac', 'virtual_ip'] are required together
# configure a front panel port with an IP
cl_interface: name=swp1  ipv4=10.1.1.1/24
notify: reload networking

# configure front panel to use DHCP
cl_interface: name=swp2 addr_family=dhcp
notify: reload networking

# configure a SVI for vlan 100 interface with an IP
cl_interface: name=bridge.100 ipv4=10.1.1.1/24
notify: reload networking

# configure subinterface with an IP
cl_interface: name=bond0.100  alias_name='my bond' ipv4=10.1.1.1/24
notify: reload networking

# define cl_interfaces once in tasks
# then write interfaces in variables file
# with just the options you want.
cl_interface:
  name: "{{ item.key }}"
  ipv4: "{{ item.value.ipv4|default(omit) }}"
  ipv6: "{{ item.value.ipv6|default(omit) }}"
  alias_name: "{{ item.value.alias_name|default(omit) }}"
  addr_method: "{{ item.value.addr_method|default(omit) }}"
  speed: "{{ item.value.link_speed|default(omit) }}"
  mtu: "{{ item.value.mtu|default(omit) }}"
  clagd_enable: "{{ item.value.clagd_enable|default(omit) }}"
  clagd_peer_ip: "{{ item.value.clagd_peer_ip|default(omit) }}"
  clagd_sys_mac: "{{ item.value.clagd_sys_mac|default(omit) }}"
  clagd_priority: "{{ item.value.clagd_priority|default(omit) }}"
  vids: "{{ item.value.vids|default(omit) }}"
  virtual_ip: "{{ item.value.virtual_ip|default(omit) }}"
  virtual_mac: "{{ item.value.virtual_mac|default(omit) }}"
  mstpctl_portnetwork: "{{ item.value.mstpctl_portnetwork|default('no') }}"
  mstpctl_portadminedge: "{{ item.value.mstpctl_portadminedge|default('no') }}"
  mstpctl_bpduguard: "{{ item.value.mstpctl_bpduguard|default('no') }}"
with_dict: cl_interfaces
notify: reload networking


# In vars file
# ============
cl_interfaces:
    swp1:
        alias_name: 'uplink to isp'
        ipv4: '10.1.1.1/24'
    swp2:
        alias_name: 'l2 trunk connection'
        vids: [1, 50]
    swp3:
        speed: 1000
        alias_name: 'connects to 1G link'
##########
#   br0 interface is configured by cl_bridge
##########
    br0.100:
        alias_name: 'SVI for vlan 100'
        ipv4: '10.2.2.2/24'
        ipv6: '10:2:2::2/127'
        virtual_ip: '10.2.2.254'
        virtual_mac: '00:00:5E:00:10:10'

Return Values

Common return values are documented here Common Return Values, the following are the fields unique to this module:

name description returned type sample
msg human-readable report of success or failure always string interface bond0 config updated
changed whether the interface was changed changed bool True

Notes

Note

As this module writes the interface directory location, ensure that /etc/network/interfaces has a ‘source /etc/network/interfaces.d/*’ or whatever path is mentioned in the location attribute.

Note

For the config to be activated, i.e installed in the kernel, “service networking reload” needs be be executed. See EXAMPLES section.

This is a Core Module

For more information on what this means please read Core Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/cl_interface_module.html