This repository has been archived by the owner on Nov 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
/
test_topology.yml
163 lines (160 loc) · 7.25 KB
/
test_topology.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
---
- hosts: localhost
connection: local
gather_facts: False
vars:
dlr_networks:
app1: {name: 'App1-Net', ip: '172.16.10.1', network: '172.16.10.0/24', prefix_len: 24, logical_switch: 'app1', iftype: 'internal'}
app2: {name: 'App2-Net', ip: '172.16.11.1', network: '172.16.11.0/24', prefix_len: 24, logical_switch: 'app2', iftype: 'internal'}
db1: {name: 'Db1-Net', ip: '172.16.12.1', network: '172.16.12.0/24', prefix_len: 24, logical_switch: 'db1', iftype: 'internal'}
web1: {name: 'Web1-Net', ip: '172.16.13.1', network: '172.16.13.0/24', prefix_len: 24, logical_switch: 'web1', iftype: 'internal'}
web2: {name: 'Web2-Net', ip: '172.16.14.1', network: '172.16.14.0/24', prefix_len: 24, logical_switch: 'web2', iftype: 'internal'}
web3: {name: 'Web3-Net', ip: '172.16.15.1', network: '172.16.15.0/24', prefix_len: 24, logical_switch: 'web3', iftype: 'internal'}
transit_net: {name: 'transit_net', ip: '172.16.1.2', prefix_len: 24, logical_switch: 'transit_net', iftype: 'uplink'}
esg_networks:
uplink: {name: 'uplink', ip: '10.114.209.94', prefix_len: 27, portgroup_id: "{{ gather_moids_upl_pg.object_id }}", iftype: 'uplink'}
transit_net: {name: 'transit_net', ip: '172.16.1.1', prefix_len: 24, logical_switch: 'transit_net', iftype: 'internal'}
vars_files:
- answerfile_TPM_Lab.yml
tasks:
- name: gather moid for ds
vcenter_gather_moids:
hostname: "{{ vcenter }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pwd }}"
datacenter_name: "{{ vcenter_dc }}"
datastore_name: "{{ vcenter_datastore }}"
validate_certs: False
register: gather_moids_ds
tags: moids
- name: gather moid for cl
vcenter_gather_moids:
hostname: "{{ vcenter }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pwd }}"
datacenter_name: "{{ vcenter_dc }}"
cluster_name: "{{ vcenter_edge_cluster }}"
validate_certs: False
register: gather_moids_cl
tags: moids
- name: gather moid for uplink vnic
vcenter_gather_moids:
hostname: "{{ vcenter }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pwd }}"
datacenter_name: "{{ vcenter_dc }}"
portgroup_name: 'vlan41'
validate_certs: False
register: gather_moids_upl_pg
tags: moids
- name: gather moid for mgmt portgroup
vcenter_gather_moids:
hostname: "{{ vcenter }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pwd }}"
datacenter_name: "{{ vcenter_dc }}"
portgroup_name: 'vlan45'
validate_certs: False
register: gather_moids_pg
tags: moids
- name: create logical switches
nsx_logical_switch:
nsxmanager_spec: "{{ nsxmanager_spec }}"
state: present
transportzone: "TZ1"
name: "{{ item.key }}"
controlplanemode: "HYBRID_MODE"
description: "{{ item.value.name }}"
with_dict: "{{ dlr_networks }}"
register: logical_switch
tags: lswitch_create
- name: ESG creation
nsx_edge_router:
nsxmanager_spec: "{{ nsxmanager_spec }}"
state: present
name: 'ansibleESG'
description: 'This ESG is created by nsxansible'
resourcepool_moid: "{{ gather_moids_cl.object_id }}"
datastore_moid: "{{ gather_moids_ds.object_id }}"
datacenter_moid: "{{ gather_moids_cl.datacenter_moid }}"
interfaces:
vnic0:
ip: "{{ esg_networks.uplink.ip }}"
prefix_len: "{{ esg_networks.uplink.prefix_len }}"
portgroup_id: "{{ esg_networks.uplink.portgroup_id }}"
name: "{{ esg_networks.uplink.name }}"
iftype: "{{ esg_networks.uplink.iftype }}"
vnic1:
ip: "{{ esg_networks.transit_net.ip }}"
prefix_len: "{{ esg_networks.transit_net.prefix_len }}"
logical_switch: "{{ esg_networks.transit_net.logical_switch }}"
name: "{{ esg_networks.transit_net.name }}"
iftype: "{{ esg_networks.transit_net.iftype }}"
default_gateway: '10.114.209.65'
routes:
- { network: "{{ dlr_networks.app1.network }}", next_hop: "{{ dlr_networks.transit_net.ip }}" }
- { network: "{{ dlr_networks.app2.network }}", next_hop: "{{ dlr_networks.transit_net.ip }}" }
- { network: "{{ dlr_networks.web1.network }}", next_hop: "{{ dlr_networks.transit_net.ip }}" }
- { network: "{{ dlr_networks.web2.network }}", next_hop: "{{ dlr_networks.transit_net.ip }}" }
- { network: "{{ dlr_networks.web3.network }}", next_hop: "{{ dlr_networks.transit_net.ip }}" }
- { network: "{{ dlr_networks.db1.network }}", next_hop: "{{ dlr_networks.transit_net.ip }}" }
remote_access: 'true'
username: 'admin'
password: 'VMware1!VMware1!'
firewall: 'false'
ha_enabled: 'true'
register: create_esg
tags: esg_create
- name: DLR creation
nsx_dlr:
nsxmanager_spec: "{{ nsxmanager_spec }}"
state: present
name: 'ansibleDLR'
description: 'This DLR is created by nsxansible'
resourcepool_moid: "{{ gather_moids_cl.object_id }}"
datastore_moid: "{{ gather_moids_ds.object_id }}"
datacenter_moid: "{{ gather_moids_cl.datacenter_moid }}"
mgmt_portgroup_moid: "{{ gather_moids_pg.object_id }}"
interfaces:
- name: "{{ dlr_networks.app1.name }}"
ip: "{{ dlr_networks.app1.ip }}"
prefix_len: "{{ dlr_networks.app1.prefix_len }}"
logical_switch: "{{ dlr_networks.app1.logical_switch }}"
iftype: "{{ dlr_networks.app1.iftype }}"
- name: "{{ dlr_networks.app2.name }}"
ip: "{{ dlr_networks.app2.ip }}"
prefix_len: "{{ dlr_networks.app2.prefix_len }}"
logical_switch: "{{ dlr_networks.app2.logical_switch }}"
iftype: "{{ dlr_networks.app2.iftype }}"
- name: "{{ dlr_networks.db1.name }}"
ip: "{{ dlr_networks.db1.ip }}"
prefix_len: "{{ dlr_networks.db1.prefix_len }}"
logical_switch: "{{ dlr_networks.db1.logical_switch }}"
iftype: "{{ dlr_networks.db1.iftype }}"
- name: "{{ dlr_networks.web1.name }}"
ip: "{{ dlr_networks.web1.ip }}"
prefix_len: "{{ dlr_networks.web1.prefix_len }}"
logical_switch: "{{ dlr_networks.web1.logical_switch }}"
iftype: "{{ dlr_networks.web1.iftype }}"
- name: "{{ dlr_networks.web2.name }}"
ip: "{{ dlr_networks.web2.ip }}"
prefix_len: "{{ dlr_networks.web2.prefix_len }}"
logical_switch: "{{ dlr_networks.web2.logical_switch }}"
iftype: "{{ dlr_networks.web2.iftype }}"
- name: "{{ dlr_networks.web3.name }}"
ip: "{{ dlr_networks.web3.ip }}"
prefix_len: "{{ dlr_networks.web3.prefix_len }}"
logical_switch: "{{ dlr_networks.web3.logical_switch }}"
iftype: "{{ dlr_networks.web3.iftype }}"
- name: "{{ dlr_networks.transit_net.name }}"
ip: "{{ dlr_networks.transit_net.ip }}"
prefix_len: "{{ dlr_networks.transit_net.prefix_len }}"
logical_switch: "{{ dlr_networks.transit_net.logical_switch }}"
iftype: "{{ dlr_networks.transit_net.iftype }}"
default_gateway: "{{ esg_networks.transit_net.ip }}"
remote_access: 'true'
username: 'admin'
password: 'VMware1!VMware1!'
ha_enabled: 'true'
register: create_dlr
tags: dlr_create