diff --git a/etc/ansible/roles/network-runner/providers/nos/add_trunk_vlan.yaml b/etc/ansible/roles/network-runner/providers/nos/add_trunk_vlan.yaml index ab0ff81..77ff9e3 100644 --- a/etc/ansible/roles/network-runner/providers/nos/add_trunk_vlan.yaml +++ b/etc/ansible/roles/network-runner/providers/nos/add_trunk_vlan.yaml @@ -5,4 +5,5 @@ - "switchport trunk allowed vlan add {{ _vlan_id }}" parents: - "interface {{ port_name }}" + match: none connection: network_cli diff --git a/etc/ansible/roles/network-runner/providers/nos/conf_access_port.yaml b/etc/ansible/roles/network-runner/providers/nos/conf_access_port.yaml index 79366c7..5a681f6 100644 --- a/etc/ansible/roles/network-runner/providers/nos/conf_access_port.yaml +++ b/etc/ansible/roles/network-runner/providers/nos/conf_access_port.yaml @@ -1,36 +1,15 @@ --- -- name: "nos: reset interface to default" +- name: "nos: restore config and then configure access port" community.network.nos_config: lines: - "no switchport" - "shutdown" - parents: - - "interface {{ port_name }}" - connection: network_cli - -- name: "nos: enable switchport in access mode" - community.network.nos_config: - lines: - "switchport" - "switchport mode access" - "no shutdown" - parents: - - "interface {{ port_name }}" - connection: network_cli - -- name: "nos: enable rstp" - community.network.nos_config: - lines: - "no spanning-tree shutdown" - parents: - - "interface {{ port_name }}" - connection: network_cli - when: stp_edge - -- name: "nos: set access mode vlan" - community.network.nos_config: - lines: - "switchport access vlan {{ _vlan_id }}" parents: - "interface {{ port_name }}" + match: none connection: network_cli diff --git a/etc/ansible/roles/network-runner/providers/nos/conf_trunk_port.yaml b/etc/ansible/roles/network-runner/providers/nos/conf_trunk_port.yaml index 4c82cd4..3130998 100644 --- a/etc/ansible/roles/network-runner/providers/nos/conf_trunk_port.yaml +++ b/etc/ansible/roles/network-runner/providers/nos/conf_trunk_port.yaml @@ -1,48 +1,28 @@ --- -- name: "nos: reset interface to default" +- name: "nos: reset interface to default and then configure it in trunk mode with native-vlan" community.network.nos_config: lines: - "no switchport" - "shutdown" - parents: - - "interface {{ port_name }}" - connection: network_cli - -- name: "nos: enable switchport in trunk mode and disable tagging of native-vlan" - community.network.nos_config: - lines: - "switchport" - "switchport mode trunk" - "no switchport trunk tag native-vlan" - "no shutdown" - parents: - - "interface {{ port_name }}" - connection: network_cli - -- name: "nos: enable rstp" - community.network.nos_config: - lines: - "no spanning-tree shutdown" - parents: - - "interface {{ port_name }}" - connection: network_cli - when: stp_edge - -- name: "nos: set native vlan" - community.network.nos_config: - lines: - "switchport trunk allowed vlan add {{ _vlan_id }}" - "switchport trunk native-vlan {{ _vlan_id }}" parents: - "interface {{ port_name }}" + match: none connection: network_cli -- name: "nos: add trunk vlan(s)" +- name: "nos: add the remainder of trunk vlan(s)" community.network.nos_config: lines: - "switchport trunk allowed vlan add {{ t_vlan }}" parents: - "interface {{ port_name }}" + match: none loop: "{{ trunked_vlans }}" loop_control: loop_var: t_vlan diff --git a/etc/ansible/roles/network-runner/providers/nos/create_vlan.yaml b/etc/ansible/roles/network-runner/providers/nos/create_vlan.yaml index b07c1ed..2a84ba9 100644 --- a/etc/ansible/roles/network-runner/providers/nos/create_vlan.yaml +++ b/etc/ansible/roles/network-runner/providers/nos/create_vlan.yaml @@ -5,4 +5,5 @@ - "name {{ _vlan_name }}" parents: - "interface vlan {{ _vlan_id }}" + match: none connection: network_cli diff --git a/etc/ansible/roles/network-runner/providers/nos/delete_port.yaml b/etc/ansible/roles/network-runner/providers/nos/delete_port.yaml index 9cabbc3..215d81c 100644 --- a/etc/ansible/roles/network-runner/providers/nos/delete_port.yaml +++ b/etc/ansible/roles/network-runner/providers/nos/delete_port.yaml @@ -6,4 +6,5 @@ - "shutdown" parents: - "interface {{ port_name }}" + match: none connection: network_cli diff --git a/etc/ansible/roles/network-runner/providers/nos/delete_trunk_vlan.yaml b/etc/ansible/roles/network-runner/providers/nos/delete_trunk_vlan.yaml index ea4b568..38d3a33 100644 --- a/etc/ansible/roles/network-runner/providers/nos/delete_trunk_vlan.yaml +++ b/etc/ansible/roles/network-runner/providers/nos/delete_trunk_vlan.yaml @@ -5,4 +5,5 @@ - "switchport trunk allowed vlan remove {{ _vlan_id }}" parents: - "interface {{ port_name }}" + match: none connection: network_cli diff --git a/etc/ansible/roles/network-runner/providers/nos/delete_vlan.yaml b/etc/ansible/roles/network-runner/providers/nos/delete_vlan.yaml index c6c9ab8..3c1ed6d 100644 --- a/etc/ansible/roles/network-runner/providers/nos/delete_vlan.yaml +++ b/etc/ansible/roles/network-runner/providers/nos/delete_vlan.yaml @@ -3,4 +3,5 @@ community.network.nos_config: lines: - "no interface vlan {{ _vlan_id }}" + match: none connection: network_cli