123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- ---
- - name: Configure switchport interface
- nxos_interfaces:
- config:
- - name: "{{ item.name }}"
- enabled: True
- mode: layer2
- with_items: "{{ n9k_switchports }}"
- tags: switchport
- - name: Configure switchport description
- nxos_interfaces:
- config:
- - name: "{{ item.name }}"
- description: "{{ item.descr }}"
- with_items: "{{ n9k_switchports }}"
- when: item.descr is defined
- tags: switchport
- - name: Configure switchport MTU
- nxos_interfaces:
- config:
- - name: "{{ item.name }}"
- mtu: "{{ item.mtu }}"
- with_items: "{{ n9k_switchports }}"
- when: item.mtu is defined
- tags: switchport
- - name: Configure switchport access parameters
- nxos_l2_interfaces:
- config:
- - name: "{{ item.name }}"
- access:
- vlan: "{{ item.access_vlan }}"
- with_items: "{{ n9k_switchports }}"
- when: item.mode == "access"
- tags: switchport
- - name: Configure switchport trunk parameters
- nxos_l2_interfaces:
- config:
- - name: "{{ item.name }}"
- trunk:
- allowed_vlans: "{{ item.trunk_allowed_vlans }}"
- with_items: "{{ n9k_switchports }}"
- when: item.mode == "trunk"
- tags: switchport
- - name: Configure port-channel interface
- nxos_interfaces:
- config:
- - name: Port-channel{{ item.port_channel }}
- enabled: True
- mode: layer2
- with_items: "{{ n9k_switchports }}"
- when: item.port_channel is defined
- tags: switchport
- - name: Configure port-channel description
- nxos_interfaces:
- config:
- - name: Port-channel{{ item.port_channel }}
- description: "{{ item.pc_descr }}"
- with_items: "{{ n9k_switchports }}"
- when: item.port_channel is defined and item.pc_descr is defined
- tags: switchport
- - name: Configure port-channel description
- nxos_interfaces:
- config:
- - name: Port-channel{{ item.port_channel }}
- description: "{{ item.descr }}"
- with_items: "{{ n9k_switchports }}"
- when: item.port_channel is defined and item.descr is defined
- tags: switchport
- - name: Configure port-channel MTU
- nxos_interfaces:
- config:
- - name: Port-channel{{ item.port_channel }}
- mtu: "{{ item.mtu }}"
- with_items: "{{ n9k_switchports }}"
- when: item.port_channel is defined and item.mtu is defined
- tags: switchport
- - name: Configure port-channel access parameters
- nxos_l2_interfaces:
- config:
- - name: Port-channel{{ item.port_channel }}
- access:
- vlan: "{{ item.access_vlan }}"
- with_items: "{{ n9k_switchports }}"
- when: item.port_channel is defined and item.mode == "access"
- tags: switchport
- - name: Configure port-channel trunk parameters
- nxos_l2_interfaces:
- config:
- - name: Port-channel{{ item.port_channel }}
- trunk:
- allowed_vlans: "{{ item.trunk_allowed_vlans }}"
- with_items: "{{ n9k_switchports }}"
- when: item.port_channel is defined and item.mode == "trunk"
- tags: switchport
- - name: Configure port-channel link aggregation
- nxos_config:
- lines:
- - channel-group {{ item.port_channel }} mode active
- parents: interface {{ item.name }}
- with_items: "{{ n9k_switchports }}"
- when: item.port_channel is defined
- tags: switchport
- - name: Set vPC on port-channel interface
- nxos_vpc_interface:
- portchannel: "{{ item.port_channel }}"
- vpc: "{{ item.port_channel }}"
- with_items: "{{ n9k_switchports }}"
- when: item.port_channel is defined and item.vpc is defined
- tags: switchport
|