forked from thisdavejohnson/nxos-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spine-vpc.yml
123 lines (97 loc) · 4.59 KB
/
spine-vpc.yml
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
---
- name: spine vpc configuration
hosts: spine
connection: local
gather_facts: no
tasks:
############################################################
# VLAN CONFIGURATION
############################################################
- name: ensure VLANs exist on switches
nxos_vlan: vlan_id="2-20,99" state=present host={{ inventory_hostname }} username={{ username }} password={{ password }}
- name: ensure names exist for important vlans
nxos_vlan: vlan_id={{ item.vlan_id }} name={{ item.name }} host={{ inventory_hostname }} state=present username={{ username }} password={{ password }}
with_items:
- { vlan_id: 10, name: test_segment }
- { vlan_id: 20, name: peer_keepalive }
- { vlan_id: 99, name: native }
#############################################################
# Layer 2 switchport configs
#############################################################
- name: L2 config for all ports except peer keepalive
nxos_switchport: interface={{ item }} mode=trunk native_vlan=99 trunk_vlans=2-20 host={{ inventory_hostname }} username={{ username }} password={{ password }}
with_items:
- Ethernet1/1
- Ethernet1/2
- Ethernet2/1
- name: L2 config for peer keepalive link
nxos_switchport: interface={{ item }} mode=trunk native_vlan=99 trunk_vlans=20 host={{ inventory_hostname }} username={{ username }} password={{ password }}
with_items:
- Ethernet2/12
#############################################################
# Portchannels
#############################################################
- nxos_portchannel:
group: 10
members: ['Ethernet1/1','Ethernet1/2']
mode: active
host: "{{ inventory_hostname }}"
state: present
username: cisco
password: "{{ password }}"
- nxos_portchannel:
group: 11
members: ['Ethernet2/1']
mode: active
host: "{{ inventory_hostname }}"
state: present
username: cisco
password: "{{ password }}"
- nxos_portchannel:
group: 12
members: ['Ethernet2/12']
mode: active
host: "{{ inventory_hostname }}"
state: present
username: cisco
password: "{{ password }}"
#############################################################
# Layer 3 Configuration
#############################################################
- name: create logical vlan interfaces
nxos_interface: interface={{ item }} host={{ inventory_hostname }} username={{ username }} password={{ password }}
with_items:
- vlan10
- vlan20
- name: ensure VRF for peer keepalive is created
nxos_vrf: vrf=keepalive host={{ inventory_hostname }} username={{ username }} password={{ password }}
- name: assgn VRF to peer keepalive link interfaces
nxos_vrf_interface: interface=vlan20 vrf=keepalive host={{ inventory_hostname }} username={{ username }} password={{ password }}
- name: assign IP addresses
nxos_ipv4_interface: interface={{ item.interface }} ip_addr={{ item.ip }} mask={{ item.mask }} host={{ inventory_hostname }} username={{ username }} password={{ password }}
with_items: layer3ip
- name: config HSRP
nxos_hsrp: group={{ item.group }} interface={{ item.interface }} vip={{ item.vip }} priority={{ hsrp_priority }} host={{ inventory_hostname }} username={{ username }} password={{ password }}
with_items: hsrp
#############################################################
# Global VPC Configuration
#############################################################
- name: global vpc configuration params
nxos_vpc:
domain={{ item.value.domain }}
system_priority={{ item.value.systempri }}
role_priority={{ item.value.rolepri }}
pkl_src={{ item.value.pkl.src }}
pkl_dest={{ item.value.pkl.dest }}
pkl_vrf={{ item.value.pkl.vrf }}
host={{ inventory_hostname }}
username={{ username }}
password={{ password }}
with_dict: vpc
#############################################################
# Portchannel VPC Configuration
#############################################################
- name: portchannel vpc peer link configuration
nxos_vpc_interface: portchannel=10 peer_link=true host={{ inventory_hostname }} username={{ username }} password={{ password }}
- name: portchannel vpc configuration
nxos_vpc_interface: portchannel=11 vpc=11 host={{ inventory_hostname }} username={{ username }} password={{ password }}