Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###
- ### Main YAML file
- ###
- - hosts: leaf_switches <<< note: this group has two elements, nx3 and nx4
- connection: local
- roles:
- - configure_access_ports
- ###
- ### vars/main.yaml
- ###
- ---
- # host (switch name), interface, description, mode (access/trunk), vlan_id (native vlan for trunk), allowed_vlans (trunks only), speed, duplex, state (admin state up/down)
- port_list:
- - { host: "nx3", interface: "Ethernet2/5", description: "server1_eth0", mode: access, vlan_id: "199", speed: "auto", duplex: "auto", state: "up" }
- - { host: "nx4", interface: "Ethernet2/5", description: "server1_eth1", mode: access, vlan_id: "199", speed: "auto", duplex: "auto", state: "up" }
- ###
- ### tasks/main.yaml
- ###
- ---
- - name: Configuring physical interface properties
- nxos_interface:
- host="{{ item.host }}"
- username="{{ username }}"
- password="{{ password }}"
- transport=nxapi
- interface="{{ item.interface }}"
- description="{{ item.description }}"
- mode=layer2
- admin_state="down"
- with_items: "{{ port_list }}"
- [...]
- ###
- ### Output
- ###
- TASK [configure_access_ports : Configuring physical interface properties] ******
- changed: [localhost] => (item={u'description': u'server1_eth0', u'duplex': u'auto', u'host': u'nx3', u'state': u'up', u'mode': u'access', u'interface': u'Ethernet2/5', u'speed': u'auto', u'vlan_id': u'199'})
- changed: [localhost] => (item={u'description': u'server1_eth1', u'duplex': u'auto', u'host': u'nx4', u'state': u'up', u'mode': u'access', u'interface': u'Ethernet2/5', u'speed': u'auto', u'vlan_id': u'199'})
- ok: [localhost] => (item={u'description': u'server2_eth0', u'duplex': u'full', u'host': u'nx3', u'state': u'down', u'mode': u'trunk', u'interface': u'Ethernet2/6', u'allowed_vlans': u'180,199', u'speed': u'1000', u'vlan_id': u'1'})
- changed: [localhost] => (item={u'description': u'server3_eth0', u'duplex': u'auto', u'host': u'nx4', u'state': u'up', u'mode': u'access', u'interface': u'Ethernet2/7', u'speed': u'auto', u'vlan_id': u'199'})
- changed: [localhost] => (item={u'description': u'server3_eth1', u'duplex': u'auto', u'host': u'nx3', u'state': u'up', u'mode': u'access', u'interface': u'Ethernet2/7', u'speed': u'auto', u'vlan_id': u'199'})
- ok: [localhost] => (item={u'description': u'server4_eth0', u'duplex': u'full', u'host': u'nx3', u'state': u'down', u'mode': u'trunk', u'interface': u'Ethernet2/8', u'allowed_vlans': u'180,199', u'speed': u'1000', u'vlan_id': u'1'})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement