cisco.ios
cisco.ios copied to clipboard
Add support for layer3 sub-interfaces using dot1q encapsulation in the cisco.ios.ios_l3_interfaces module
SUMMARY
Add support for layer3 sub-interfaces using dot1q encapsulation in the cisco.ios.ios_l3_interfaces module
ISSUE TYPE
- Feature idea to support L3 sub-interfaces on IOS devices
- This feature should be identical in implementation with the cisco.nxos.nxos_l3_interfaces module support for "dot1q" encap
COMPONENT NAME
This would be an enhancement to the existing cisco.ios.ios_l3_interfaces module
ADDITIONAL INFORMATION
Workaround today is to use a Jinja template called from a role setup to configure L3 interfaces.
# The cisco.ios.ios_l3_interfaces module does not support sub-interfaces as a result
# we need to use a Jinja template for the interface L3 configuration. The regular cisco.ios.ios_l2_interfaces
# module allows for sub-interface creation but no encap assignment is possible in cisco.ios.ios_l3_interfaces
- name: IOS L3 Interface Jinja Template
cisco.ios.ios_config:
src: "cisco.ios.ios_l3_interfaces"
register: results
when: l3_interface_list | length > 0
Template: cisco.ios.ios_l3_interfaces
{% for intf in l3_interfaces %}
interface {{ intf.name }}
{% if intf.dot1q is defined %}
encapsulation dot1q {{ intf.dot1q }}
{% endif %}
{% if intf.ipv4 is defined %}
ip address {{ intf.ipv4[0].address | ansible.utils.ipaddr('address') }} {{ intf.ipv4[0].address | ansible.utils.ipaddr('netmask') }}
{% endif %}
{% endfor %}