access: add voice VLAN support

This commit is contained in:
Timotej Lazar 2024-09-01 10:37:11 +02:00
parent c3ff39fe72
commit 3caea81896
2 changed files with 20 additions and 1 deletions

View file

@ -5,7 +5,10 @@
- name: Set configuration - name: Set configuration
ansible.netcommon.cli_config: ansible.netcommon.cli_config:
config: '{{ lookup("template", "config-"~manufacturer~"-"~device_type~".j2") }}' config: '{{ lookup("template", "config-"~manufacturer~"-"~device_type~".j2") }}'
vars:
ansible_command_timeout: 60
ansible_terminal_stderr_re: [] # some errors are not actually errors
register: result register: result
# These lines are not displayed by 'sho ru' and always reported as different, so ignore them. # These lines are not displayed by 'sho ru' and always reported as different, so ignore them.
changed_when: result.commands | reject('match', '^(no shutdown|no switchport access vlan|switchport mode access|switchport mode hybrid|interface .*|no enable service web-server https?)$') changed_when: result.commands | reject('match', '^(no shutdown|no switchport access vlan|no voice vlan.*|switchport mode access|switchport mode hybrid|interface .*|no enable service web-server https?)$')
notify: write config notify: write config

View file

@ -30,6 +30,11 @@ interface {{ iface.name }}
{% else %} {% else %}
no switchport access vlan no switchport access vlan
{% endif %} {% endif %}
{% if voice_vlan is defined and not iface.mgmt_only %}
voice vlan enable
{% else %}
no voice vlan enable
{% endif %}
{%+ elif iface.mode and iface.mode.value == 'tagged' %} {%+ elif iface.mode and iface.mode.value == 'tagged' %}
switchport mode trunk switchport mode trunk
@ -52,6 +57,17 @@ interface Vlan1
ip address {{ mgmt.ip | ipaddr('address') }} {{ mgmt.ip | ipaddr('netmask') }} ip address {{ mgmt.ip | ipaddr('address') }} {{ mgmt.ip | ipaddr('netmask') }}
{% endif %} {% endif %}
voice vlan mac-address 2C-3E-CF-00-00-00 FF-FF-FF-00-00-00 description Cisco
voice vlan mac-address 3C-0E-23-00-00-00 FF-FF-FF-00-00-00 description Cisco
voice vlan mac-address B8-38-61-00-00-00 FF-FF-FF-00-00-00 description Cisco
voice vlan mac-address C4-14-3C-00-00-00 FF-FF-FF-00-00-00 description Cisco
{% if voice_vlan is defined %}
voice vlan {{ voice_vlan }}
{% else %}
no voice vlan
{% endif %}
snmp-server name {{ inventory_hostname }} snmp-server name {{ inventory_hostname }}
sntp enable sntp enable