ansible-network / network-engine

This role provides the foundation for building network roles by providing modules and plugins that are common to all Ansible Network roles.
GNU General Public License v3.0
112 stars 53 forks source link

Short name interface_split function #243

Open ryanmerolle opened 4 years ago

ryanmerolle commented 4 years ago

ISSUE TYPE

ANSIBLE VERSION

ansible 2.9.0
  config file = None
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/.local/lib/python3.6/site-packages/ansible
  executable location = /home/user/.local/bin/ansible
  python version = 3.6.8 (default, Oct  7 2019, 12:59:55) [GCC 8.3.0]

ansible-network.network-engine, v2.7.5

Network OS

All

SUMMARY

Nearly all Network OS report a short name for interfaces. It would be useful for interface_split or a similar filter to spit such short names out given a full interface name.

EXPECTED RESULTS

{{ 'Ethernet1/1' | interface_split('shortname') }} returns 'Et1/1' {{ 'Loopback0' | interface_split('shortname') }} returns 'Lo0' {{ 'TenGigabitEthernet1/0/1' | interface_split('shortname') }} returns 'Te1/0/1' {{ 'Tunnel1' | interface_split('shortname') }} returns 'Tu1'