Skip to content

Commit ea26414

Browse files
authored
Merge pull request #6 from jvanderaa/update_modules3
Updates for Nautobot 3+ modules
2 parents 4c5a619 + 9a9dee3 commit ea26414

13 files changed

+530
-587
lines changed

.bandit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
skips: ["B101"]
2+
skips: ["B101", "B113"]

.pylintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ disable=print-statement,
143143
comprehension-escape,
144144
import-error,
145145
too-many-lines,
146-
too-many-return-statements
146+
too-many-return-statements,
147+
missing-timeout
147148

148149
# Enable the message, report, category or checker with the given id(s). You can
149150
# either give multiple identifier separated by comma (,) or put this option

00_setup_nautobot_devices.yml

Lines changed: 65 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -9,193 +9,206 @@
99
networktocode.nautobot.site:
1010
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
1111
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
12-
data: "{{ site }}"
12+
name: "{{ site['name'] }}"
13+
time_zone: "{{ site['time_zone'] }}"
14+
status: "{{ site['status'] }}"
15+
description: "{{ site['description'] }}"
16+
contact_name: "{{ site['contact_name'] }}"
17+
contact_email: "{{ site['contact_email'] }}"
1318
validate_certs: False
1419
register: site_setup
1520
loop: "{{ sites }}"
1621
loop_control:
1722
loop_var: site
1823
label: "{{ site['name'] }}"
19-
tags: [ sites, devices ]
24+
tags: [sites, devices]
2025

2126
- name: "TASK 2: SETUP RACKS"
2227
networktocode.nautobot.rack:
2328
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
2429
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
25-
data: "{{ rack }}"
30+
name: "{{ rack['name'] }}"
31+
site: "{{ rack['site'] }}"
32+
status: "{{ rack['status'] }}"
2633
state: "{{ install_state }}"
2734
validate_certs: False
2835
loop: "{{ racks }}"
2936
loop_control:
3037
loop_var: rack
3138
label: "{{ rack['name'] }}"
32-
tags: [ sites, devices ]
39+
tags: [sites, devices]
3340

3441
- name: "TASK 3: SETUP MANUFACTURERS"
3542
networktocode.nautobot.manufacturer:
3643
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
3744
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
38-
data:
39-
name: "{{ manufacturer }}"
45+
name: "{{ manufacturer }}"
4046
state: "{{ install_state }}"
4147
validate_certs: False
4248
loop: "{{ manufacturers }}"
4349
loop_control:
4450
loop_var: manufacturer
45-
tags: [ devices ]
51+
tags: [devices]
4652

4753
- name: "TASK 4: SETUP DEVICE TYPES"
4854
networktocode.nautobot.device_type:
4955
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
5056
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
51-
data:
52-
model: "{{ device_type.model }}"
53-
manufacturer: "{{ device_type.manufacturer }}"
54-
slug: "{{ device_type.slug }}"
55-
part_number: "{{ device_type.part_number }}"
56-
u_height: 1
57-
is_full_depth: "{{ device_type.full_depth }}"
57+
model: "{{ device_type.model }}"
58+
manufacturer: "{{ device_type.manufacturer }}"
59+
slug: "{{ device_type.slug }}"
60+
part_number: "{{ device_type.part_number }}"
61+
u_height: 1
62+
is_full_depth: "{{ device_type.full_depth }}"
5863
state: "{{ install_state }}"
5964
validate_certs: False
6065
loop: "{{ device_types }}"
6166
loop_control:
6267
loop_var: device_type
6368
label: "{{ device_type['model'] }}"
64-
tags: [ devices ]
69+
tags: [devices]
6570

6671
- name: "TASK 5: SETUP PLATFORMS"
6772
networktocode.nautobot.platform:
6873
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
6974
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
70-
data:
71-
name: "{{ platform.name }}"
72-
slug: "{{ platform.slug }}"
75+
name: "{{ platform.name }}"
76+
slug: "{{ platform.slug }}"
7377
state: "{{ install_state }}"
7478
validate_certs: False
7579
loop: "{{ platforms }}"
7680
loop_control:
7781
loop_var: platform
7882
label: "{{ platform['name'] }}"
79-
tags: [ devices ]
83+
tags: [devices]
8084

8185
- name: "TASK 6: SETUP DEVICE ROLES"
8286
networktocode.nautobot.device_role:
8387
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
8488
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
85-
data:
86-
name: "{{ device_role.name }}"
87-
color: "{{ device_role.color }}"
88-
vm_role: "{{ device_role.vmrole }}"
89+
name: "{{ device_role.name }}"
90+
color: "{{ device_role.color }}"
91+
vm_role: "{{ device_role.vmrole }}"
8992
state: "{{ install_state }}"
9093
validate_certs: False
9194
loop: "{{ device_roles }}"
9295
loop_control:
9396
loop_var: device_role
9497
label: "{{ device_role['name'] }}"
95-
tags: [ devices ]
98+
tags: [devices]
9699

97100
- name: "TASK 7: SETUP VLANS"
98101
networktocode.nautobot.vlan:
99102
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
100103
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
101-
data:
102-
name: "VLAN{{ vlan.vid }}"
103-
vid: "{{ vlan.vid }}"
104-
site: "MINNESOTA01"
105-
description: "{{ vlan.desc }}"
106-
status: "Active"
104+
name: "VLAN{{ vlan.vid }}"
105+
vid: "{{ vlan.vid }}"
106+
site: "MINNESOTA01"
107+
description: "{{ vlan.desc }}"
108+
status: "Active"
107109
state: "{{ install_state }}"
108110
validate_certs: False
109111
register: result
110112
loop: "{{ vlans }}"
111113
loop_control:
112114
loop_var: vlan
113115
label: "{{ vlan['vid'] }}"
114-
tags: [ ipam ]
116+
tags: [ipam]
115117

116118
- name: "TASK 8: SETUP RFC1918 RIR"
117119
networktocode.nautobot.rir:
118120
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
119121
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
120-
data: "{{ rir }}"
122+
name: RFC1918
123+
is_private: True
121124
state: "{{ install_state }}"
122125
validate_certs: False
123126
loop: "{{ rirs }}"
124127
loop_control:
125128
loop_var: rir
126129
label: "{{ rir['name'] }}"
127-
tags: [ ipam ]
130+
tags: [ipam]
128131

129132
- name: "TASK 8: SETUP AGGREGRATES"
130133
networktocode.nautobot.aggregate:
131134
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
132135
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
133-
data:
134-
prefix: "{{ aggregate.name }}"
135-
description: "{{ aggregate.desc }}"
136-
rir: "{{ aggregate.rir }}"
136+
prefix: "{{ aggregate.name }}"
137+
description: "{{ aggregate.desc }}"
138+
rir: "{{ aggregate.rir }}"
137139
state: "{{ install_state }}"
138140
validate_certs: False
139141
loop: "{{ aggregates }}"
140142
loop_control:
141143
loop_var: aggregate
142144
label: "{{ aggregate['name'] }}"
143-
tags: [ ipam ]
145+
tags: [ipam]
144146

145147
- name: "TASK 9: SETUP PREFIXES"
146148
networktocode.nautobot.prefix:
147149
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
148150
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
149-
data:
150-
family: 4
151-
prefix: "{{ prefix.prefix }}"
152-
site: "{{ prefix.site | default(omit) }}"
153-
status: "{{ prefix.status | default('Active') }}"
154-
description: "{{ prefix.desc }}"
155-
is_pool: "{{ prefix.ispool }}"
151+
family: 4
152+
prefix: "{{ prefix.prefix }}"
153+
site: "{{ prefix.site | default(omit) }}"
154+
status: "{{ prefix.status | default('Active') }}"
155+
description: "{{ prefix.desc }}"
156+
is_pool: "{{ prefix.ispool }}"
156157
state: "{{ install_state }}"
157158
validate_certs: False
158159
loop: "{{ prefixes }}"
159160
loop_control:
160161
loop_var: prefix
161162
label: "{{ prefix['prefix'] }}"
162-
tags: [ ipam ]
163+
tags: [ipam]
163164

164165
- name: "TASK 10: SETUP CIRCUIT PROVIDER"
165166
networktocode.nautobot.provider:
166167
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
167168
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
168-
data: "{{ circuit_provider }}"
169+
name: "{{ circuit_provider['name'] }}"
170+
asn: "{{ circuit_provider['asn'] }}"
171+
account: "{{ circuit_provider['account'] }}"
172+
portal_url: "{{ circuit_provider['portal_url'] }}"
173+
noc_contact: "{{ circuit_provider['noc_contact'] }}"
174+
comments: "{{ circuit_provider['comments'] }}"
169175
state: "{{ install_state }}"
170176
validate_certs: False
171177
loop: "{{ circuit_providers }}"
172178
loop_control:
173179
loop_var: circuit_provider
174180
label: "{{ circuit_provider['name'] }}"
175-
tags: [ circuit ]
181+
tags: [circuit]
176182

177183
- name: Create type within Nautobot with only required information
178184
networktocode.nautobot.circuit_type:
179185
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
180186
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
181-
data: "{{ circuit_type }}"
187+
name: "{{ circuit_type['name'] }}"
182188
state: "{{ install_state }}"
183189
validate_certs: False
184190
loop: "{{ circuit_types }}"
185191
loop_control:
186192
loop_var: circuit_type
187193
label: "{{ circuit_type['name'] }}"
188-
tags: [ circuit ]
194+
tags: [circuit]
189195

190196
- name: "CREATE LOCAL CIRCUIT"
191197
networktocode.nautobot.circuit:
192198
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
193199
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
194-
data: "{{ circuit }}"
200+
cid: "{{ circuit['cid'] }}"
201+
provider: "{{ circuit['provider'] }}"
202+
circuit_type: "{{ circuit['circuit_type'] }}"
203+
status: "{{ circuit['status'] }}"
204+
install_date: "{{ circuit['install_date'] }}"
205+
commit_rate: "{{ circuit['commit_rate'] }}"
206+
description: "{{ circuit['description'] }}"
207+
comments: "{{ circuit['comments'] }}"
195208
state: "{{ install_state }}"
196209
validate_certs: False
197210
loop: "{{ circuits }}"
198211
loop_control:
199212
loop_var: circuit
200213
label: "{{ circuit['cid'] }}"
201-
tags: [ circuit ]
214+
tags: [circuit]

0 commit comments

Comments
 (0)