-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterface_description.yml
More file actions
31 lines (25 loc) · 1.03 KB
/
interface_description.yml
File metadata and controls
31 lines (25 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---
#Task 1: Configure uplinks to spines
- hosts: all
vars:
nxos_provider:
username: "{{ user }}"
password: "{{ pwd }}"
transport: cli
host: "{{ hostvars[inventory_hostname].ansible_host }}"
tasks:
- name: GATHER FACTS FOR Leaf "{{ inventory_hostname }}"
nxos_facts:
provider: "{{ nxos_provider }}"
- debug: var=ansible_net_neighbors
- name: create interface keys
set_fact:
interfaces: "{{ ansible_net_neighbors.keys() }}"
- debug: var=interfaces
- name: Ensure an interface has the proper description
nxos_interface:
provider: "{{ nxos_provider }}"
name: "{{ item }}"
description: 'Connected-to-{{ ansible_net_neighbors[item][0]["port"] }}-{{ ansible_net_neighbors[item][0]["sysname"] }} '
with_items: "{{ interfaces}}"
when: ansible_net_neighbors[item][0]["sysname"] is search("Spine") or ansible_net_neighbors[item][0]["sysname"] is search("Leaf")