-
Notifications
You must be signed in to change notification settings - Fork 0
/
tenant.yaml
102 lines (94 loc) · 3.52 KB
/
tenant.yaml
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
#############################################################################
# #
# Copyright (c) 2020 Cisco Systems #
# All Rights Reserved. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
# License for the specific language governing permissions and limitations #
# under the License. #
# #
################################################################################
---
- name: Configure tenant policies
hosts: apic
connection: local
gather_facts: no
# Use aci_login as an anchor
vars:
aci_login: &aci_login
host: "{{ inventory_hostname }}"
username: "{{ username }}"
password: "{{ password }}"
validate_certs: no
use_proxy: no
state: present
tasks:
#Read in values from CSV file
- name: Read info from CSV file and return a list
read_csv:
path: tenant_data.csv
register: tn
delegate_to: localhost
#Create Tenant - single value not in CSV
- name: Create Tenant
cisco.aci.aci_tenant:
<<: *aci_login
tenant: "{{ tenant }}"
delegate_to: localhost
#Create VRF - single value not in CSV
- name: Create VRF
cisco.aci.aci_vrf:
<<: *aci_login
tenant: "{{ tenant }}"
vrf: "{{ vrf }}"
delegate_to: localhost
#Create Bridge Domains
- name: Create Bridge Domains
cisco.aci.aci_bd:
<<: *aci_login
tenant: "{{ tenant }}"
bd: "{{ item.bd }}"
enable_routing: no
arp_flooding: yes
l2_unknown_unicast: flood
delegate_to: localhost
loop: "{{ tn.list }}"
#Create Application Profiles
- name: Create Application Profiles
cisco.aci.aci_ap:
<<: *aci_login
tenant: "{{ tenant }}"
ap: "{{ item.ap }}"
description: "{{ item.ap_descr }}"
delegate_to: localhost
loop: "{{ tn.list }}"
#Create EPGs
- name: Create EPGs
cisco.aci.aci_epg:
<<: *aci_login
tenant: "{{ tenant }}"
ap: "{{ item.ap }}"
epg: "{{ item.epg }}"
bd: "{{ item.bd }}"
description: "{{ item.epg_descr }}"
delegate_to: localhost
loop: "{{ tn.list }}"
#Associate physical domain to EPG
- name: Associate physical domain to EPG
cisco.aci.aci_epg_to_domain:
<<: *aci_login
tenant: "{{ tenant }}"
ap: "{{ item.ap }}"
epg: "{{ item.epg }}"
domain: "{{ physDom }}"
domain_type: phys
delegate_to: localhost
loop: "{{ tn.list }}"