Skip to content

Commit

Permalink
Merge pull request #6 from jvanderaa/update_modules3
Browse files Browse the repository at this point in the history
Updates for Nautobot 3+ modules
  • Loading branch information
jvanderaa authored Mar 21, 2023
2 parents 4c5a619 + 9a9dee3 commit ea26414
Show file tree
Hide file tree
Showing 13 changed files with 530 additions and 587 deletions.
2 changes: 1 addition & 1 deletion .bandit.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
skips: ["B101"]
skips: ["B101", "B113"]
3 changes: 2 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ disable=print-statement,
comprehension-escape,
import-error,
too-many-lines,
too-many-return-statements
too-many-return-statements,
missing-timeout

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
117 changes: 65 additions & 52 deletions 00_setup_nautobot_devices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,193 +9,206 @@
networktocode.nautobot.site:
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
data: "{{ site }}"
name: "{{ site['name'] }}"
time_zone: "{{ site['time_zone'] }}"
status: "{{ site['status'] }}"
description: "{{ site['description'] }}"
contact_name: "{{ site['contact_name'] }}"
contact_email: "{{ site['contact_email'] }}"
validate_certs: False
register: site_setup
loop: "{{ sites }}"
loop_control:
loop_var: site
label: "{{ site['name'] }}"
tags: [ sites, devices ]
tags: [sites, devices]

- name: "TASK 2: SETUP RACKS"
networktocode.nautobot.rack:
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
data: "{{ rack }}"
name: "{{ rack['name'] }}"
site: "{{ rack['site'] }}"
status: "{{ rack['status'] }}"
state: "{{ install_state }}"
validate_certs: False
loop: "{{ racks }}"
loop_control:
loop_var: rack
label: "{{ rack['name'] }}"
tags: [ sites, devices ]
tags: [sites, devices]

- name: "TASK 3: SETUP MANUFACTURERS"
networktocode.nautobot.manufacturer:
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
data:
name: "{{ manufacturer }}"
name: "{{ manufacturer }}"
state: "{{ install_state }}"
validate_certs: False
loop: "{{ manufacturers }}"
loop_control:
loop_var: manufacturer
tags: [ devices ]
tags: [devices]

- name: "TASK 4: SETUP DEVICE TYPES"
networktocode.nautobot.device_type:
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
data:
model: "{{ device_type.model }}"
manufacturer: "{{ device_type.manufacturer }}"
slug: "{{ device_type.slug }}"
part_number: "{{ device_type.part_number }}"
u_height: 1
is_full_depth: "{{ device_type.full_depth }}"
model: "{{ device_type.model }}"
manufacturer: "{{ device_type.manufacturer }}"
slug: "{{ device_type.slug }}"
part_number: "{{ device_type.part_number }}"
u_height: 1
is_full_depth: "{{ device_type.full_depth }}"
state: "{{ install_state }}"
validate_certs: False
loop: "{{ device_types }}"
loop_control:
loop_var: device_type
label: "{{ device_type['model'] }}"
tags: [ devices ]
tags: [devices]

- name: "TASK 5: SETUP PLATFORMS"
networktocode.nautobot.platform:
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
data:
name: "{{ platform.name }}"
slug: "{{ platform.slug }}"
name: "{{ platform.name }}"
slug: "{{ platform.slug }}"
state: "{{ install_state }}"
validate_certs: False
loop: "{{ platforms }}"
loop_control:
loop_var: platform
label: "{{ platform['name'] }}"
tags: [ devices ]
tags: [devices]

- name: "TASK 6: SETUP DEVICE ROLES"
networktocode.nautobot.device_role:
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
data:
name: "{{ device_role.name }}"
color: "{{ device_role.color }}"
vm_role: "{{ device_role.vmrole }}"
name: "{{ device_role.name }}"
color: "{{ device_role.color }}"
vm_role: "{{ device_role.vmrole }}"
state: "{{ install_state }}"
validate_certs: False
loop: "{{ device_roles }}"
loop_control:
loop_var: device_role
label: "{{ device_role['name'] }}"
tags: [ devices ]
tags: [devices]

- name: "TASK 7: SETUP VLANS"
networktocode.nautobot.vlan:
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
data:
name: "VLAN{{ vlan.vid }}"
vid: "{{ vlan.vid }}"
site: "MINNESOTA01"
description: "{{ vlan.desc }}"
status: "Active"
name: "VLAN{{ vlan.vid }}"
vid: "{{ vlan.vid }}"
site: "MINNESOTA01"
description: "{{ vlan.desc }}"
status: "Active"
state: "{{ install_state }}"
validate_certs: False
register: result
loop: "{{ vlans }}"
loop_control:
loop_var: vlan
label: "{{ vlan['vid'] }}"
tags: [ ipam ]
tags: [ipam]

- name: "TASK 8: SETUP RFC1918 RIR"
networktocode.nautobot.rir:
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
data: "{{ rir }}"
name: RFC1918
is_private: True
state: "{{ install_state }}"
validate_certs: False
loop: "{{ rirs }}"
loop_control:
loop_var: rir
label: "{{ rir['name'] }}"
tags: [ ipam ]
tags: [ipam]

- name: "TASK 8: SETUP AGGREGRATES"
networktocode.nautobot.aggregate:
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
data:
prefix: "{{ aggregate.name }}"
description: "{{ aggregate.desc }}"
rir: "{{ aggregate.rir }}"
prefix: "{{ aggregate.name }}"
description: "{{ aggregate.desc }}"
rir: "{{ aggregate.rir }}"
state: "{{ install_state }}"
validate_certs: False
loop: "{{ aggregates }}"
loop_control:
loop_var: aggregate
label: "{{ aggregate['name'] }}"
tags: [ ipam ]
tags: [ipam]

- name: "TASK 9: SETUP PREFIXES"
networktocode.nautobot.prefix:
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
data:
family: 4
prefix: "{{ prefix.prefix }}"
site: "{{ prefix.site | default(omit) }}"
status: "{{ prefix.status | default('Active') }}"
description: "{{ prefix.desc }}"
is_pool: "{{ prefix.ispool }}"
family: 4
prefix: "{{ prefix.prefix }}"
site: "{{ prefix.site | default(omit) }}"
status: "{{ prefix.status | default('Active') }}"
description: "{{ prefix.desc }}"
is_pool: "{{ prefix.ispool }}"
state: "{{ install_state }}"
validate_certs: False
loop: "{{ prefixes }}"
loop_control:
loop_var: prefix
label: "{{ prefix['prefix'] }}"
tags: [ ipam ]
tags: [ipam]

- name: "TASK 10: SETUP CIRCUIT PROVIDER"
networktocode.nautobot.provider:
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
data: "{{ circuit_provider }}"
name: "{{ circuit_provider['name'] }}"
asn: "{{ circuit_provider['asn'] }}"
account: "{{ circuit_provider['account'] }}"
portal_url: "{{ circuit_provider['portal_url'] }}"
noc_contact: "{{ circuit_provider['noc_contact'] }}"
comments: "{{ circuit_provider['comments'] }}"
state: "{{ install_state }}"
validate_certs: False
loop: "{{ circuit_providers }}"
loop_control:
loop_var: circuit_provider
label: "{{ circuit_provider['name'] }}"
tags: [ circuit ]
tags: [circuit]

- name: Create type within Nautobot with only required information
networktocode.nautobot.circuit_type:
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
data: "{{ circuit_type }}"
name: "{{ circuit_type['name'] }}"
state: "{{ install_state }}"
validate_certs: False
loop: "{{ circuit_types }}"
loop_control:
loop_var: circuit_type
label: "{{ circuit_type['name'] }}"
tags: [ circuit ]
tags: [circuit]

- name: "CREATE LOCAL CIRCUIT"
networktocode.nautobot.circuit:
url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
data: "{{ circuit }}"
cid: "{{ circuit['cid'] }}"
provider: "{{ circuit['provider'] }}"
circuit_type: "{{ circuit['circuit_type'] }}"
status: "{{ circuit['status'] }}"
install_date: "{{ circuit['install_date'] }}"
commit_rate: "{{ circuit['commit_rate'] }}"
description: "{{ circuit['description'] }}"
comments: "{{ circuit['comments'] }}"
state: "{{ install_state }}"
validate_certs: False
loop: "{{ circuits }}"
loop_control:
loop_var: circuit
label: "{{ circuit['cid'] }}"
tags: [ circuit ]
tags: [circuit]
Loading

0 comments on commit ea26414

Please sign in to comment.