-
Notifications
You must be signed in to change notification settings - Fork 10
/
deploy_2tier_dedicated_datacenter.yml
194 lines (168 loc) · 5.83 KB
/
deploy_2tier_dedicated_datacenter.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
- hosts: all
gather_facts: False
collections:
- arubanetworks.aoscx
vars:
ansible_connection: network_cli
tasks:
- name: Generate Template for Device
template: src="{{config_template}}" dest="{{config_path}}{{hostname}}.conf" mode='0777'
- name: Copy generated config to device via SSH
aoscx_config:
src: "{{config_path}}{{hostname}}.conf"
- name: Configure system interface-group speeds when provided
block:
- name: Enable auto-confirm
aoscx_command:
commands: ['auto-confirm']
- name: enabling 10g speed on system interface-group {{item}}
aoscx_config:
lines:
- system interface-group {{item}} speed 10g
loop: "{{speed_interface_group_10g}}"
- name: Disable auto-confirm
aoscx_command:
commands: ['no auto-confirm']
when: speed_interface_group_10g is defined
- hosts: core
gather_facts: False
collections:
- arubanetworks.aoscx
tasks:
- set_fact:
is_primary: "{{ vsx_role == 'primary' }}"
- name: Enable keepalive Interface
aoscx_interface:
name: "{{ vsx_keepalive_int }}"
enabled: true
description: "VSX KA"
- name: Create VSX keepalive L3 interface
aoscx_l3_interface:
interface: "{{ vsx_keepalive_int }}"
description: "VSX KA"
ipv4: "{{ vsx_keepalive_ip_primary if is_primary else vsx_keepalive_ip_secondary}}/31"
- name: Create ISL LAG for VSX
aoscx_lag_interface:
state: create
name: lag{{ vsx_isl_lagid }}
interfaces: "{{ vsx_isl_ports }}"
- name: Enable ISL LAG for VSX
aoscx_interface:
name: lag{{ vsx_isl_lagid }}
enabled: true
description: "VSX ISL"
- name: Create VSX configuration
aoscx_vsx:
device_role: "{{ vsx_role }}"
isl_port: lag"{{ vsx_isl_lagid }}"
keepalive_peer_ip: "{{ vsx_keepalive_ip_secondary if is_primary else vsx_keepalive_ip_primary }}"
keepalive_src_ip: "{{ vsx_keepalive_ip_primary if is_primary else vsx_keepalive_ip_secondary }}"
system_mac: "{{ vsx_system_mac }}"
- name: Create VLANs
aoscx_vlan:
vlan_id: "{{ item }}"
with_items: "{{ server_vlans }}"
- name: Create VLAN interface
aoscx_vlan_interface:
vlan_id: "{{item.vlan_id}}"
ipv4: "{{item.ipv4}}"
active_gateway_ip: "{{item.active_gateway_ip}}"
active_gateway_mac_v4: "{{item.active_gateway_mac}}"
loop: "{{core_vlan_interfaces}}"
- name: Create Downstream MCLAG to Access
aoscx_lag_interface:
state: create
name: lag{{ vsx_pair_dict.mclag_id }}
interfaces: "{{ vsx_pair_dict.access_mclag_downlink_ports }}"
multi_chassis: true
loop: "{{vsx_pair_mclags}}"
loop_control:
loop_var: vsx_pair_dict
- name: Configure MCLAG L2 Interface
aoscx_l2_interface:
interface: lag{{ vsx_pair_dict.mclag_id }}
vlan_mode: trunk
vlan_trunks: "{{ vsx_pair_dict.trunk_vlans}}"
loop: "{{vsx_pair_mclags}}"
loop_control:
loop_var: vsx_pair_dict
- name: Enable MCLAG Interface
aoscx_interface:
name: lag{{ vsx_pair_dict.mclag_id }}
enabled: true
description: "{{vsx_pair_dict.mclag_description }}"
loop: "{{vsx_pair_mclags}}"
loop_control:
loop_var: vsx_pair_dict
- name: Create Core BGP Neighbor
include: tasks/aoscx/bgp_neighbor.yml
vars:
bgp_asn: "{{asn}}"
neighbor_ip: "{{core_vsx_neighbor_ip}}"
ipv4_unicast: True
nexthopself: True
ebgp_hop_count: 1
remote_as: "{{asn}}"
- hosts: access
gather_facts: False
collections:
- arubanetworks.aoscx
tasks:
- set_fact:
is_primary: "{{ vsx_role == 'primary' }}"
- name: Enable keepalive Interface
aoscx_interface:
name: "{{ vsx_keepalive_int }}"
enabled: true
description: "VSX KA"
- name: Create VSX keepalive L3 interface
aoscx_l3_interface:
interface: "{{ vsx_keepalive_int }}"
description: "VSX KA"
ipv4: "{{ vsx_keepalive_ip_primary if is_primary else vsx_keepalive_ip_secondary}}/31"
- name: Create ISL LAG for VSX
aoscx_lag_interface:
state: create
name: lag{{ vsx_isl_lagid }}
interfaces: "{{ vsx_isl_ports }}"
- name: Enable ISL LAG for VSX
aoscx_interface:
name: lag{{ mclag_id }}
enabled: true
description: "VSX ISL"
- name: Create VSX configuration
aoscx_vsx:
device_role: "{{ vsx_role }}"
isl_port: lag"{{ vsx_isl_lagid }}"
keepalive_peer_ip: "{{ vsx_keepalive_ip_secondary if is_primary else vsx_keepalive_ip_primary }}"
keepalive_src_ip: "{{ vsx_keepalive_ip_primary if is_primary else vsx_keepalive_ip_secondary }}"
system_mac: "{{ vsx_system_mac }}"
- name: Create VLANs
aoscx_vlan:
vlan_id: "{{ item }}"
with_items: "{{ server_vlans }}"
- name: Create Upstream MCLAG to Cores
aoscx_lag_interface:
state: create
name: lag{{ vsx_pair_dict.mclag_id }}
interfaces: "{{ vsx_pair_dict.access_mclag_downlink_ports }}"
multi_chassis: true
loop: "{{vsx_pair_mclags}}"
loop_control:
loop_var: vsx_pair_dict
- name: Configure MCLAG L2 Interface
aoscx_l2_interface:
interface: lag{{ vsx_pair_dict.mclag_id }}
vlan_mode: trunk
vlan_trunks: "{{ vsx_pair_dict.trunk_vlans}}"
loop: "{{vsx_pair_mclags}}"
loop_control:
loop_var: vsx_pair_dict
- name: Enable MCLAG Interface
aoscx_interface:
name: lag{{ vsx_pair_dict.mclag_id }}
enabled: true
description: "{{vsx_pair_dict.mclag_description }}"
loop: "{{vsx_pair_mclags}}"
loop_control:
loop_var: vsx_pair_dict