Include information in netbox_inventory

This commit is contained in:
2020-05-21 10:54:19 -04:00
parent 342fc5e506
commit 7a8f957c3f
5 changed files with 41 additions and 27 deletions

2
.gitignore vendored
View File

@@ -112,3 +112,5 @@ roles/
.vscode/
keys/
collections/ansible_collections/
.vscode/

View File

@@ -1 +1,3 @@
{}
{
"git.ignoreLimitWarning": true
}

View File

@@ -1,23 +0,0 @@
plugin: netbox
validate_certs: False
config_context: True
group_by:
- device_roles
#query_filters:
# - role: core-switch
#query_filters:
# - role: network-edge-router
# Query filters are passed directly as an argument to the fetching queries.
# You can repeat tags in the query string.
#query_filters:
# - role: server
# - tag: web
# - tag: production
#compose:
# foo: last_updated
# bar: display_name

View File

@@ -3,7 +3,17 @@ plugin: netbox.netbox.nb_inventory
api_endpoint: http://netbox.mgmt.toal.ca
validate_certs: True
config_context: True
interfaces: True
services: True
plurals: False
group_by:
- device_roles
#query_filters:
# - role: network-edge-router
- site
- tag
- role
- platform
- cluster
#query_filters:
# - role: network-edge-router

23
switch_config.yml Normal file
View File

@@ -0,0 +1,23 @@
---
- name: Collect Netbox Data
hosts: role_core-switch
gather_facts: false
collections:
- netbox.netbox
vars:
api_endpoint: "{{ lookup('env','NETBOX_API') }}"
api_token: "{{ lookup('env', 'NETBOX_TOKEN') }}"
tasks:
# - name: Gather Device Information
# set_fact:
# device_info: "{{ query('netbox.netbox.nb_lookup', 'devices', api_filter='name=' + inventory_hostname, api_endpoint=api_endpoint, token=api_token )[0] }}"
- debug:
var: interfaces
# - name: Obtain list of devices from Netbox
# debug:
# var: >
# "Device {{ item.value.display_name }} (ID: {{ item.key }}) was
# manufactured by {{ item.value.device_type.manufacturer.name }}"
# loop: "{{ query('netbox.netbox.nb_lookup', 'devices', api_endpoint=api_endpoint, token=api_token ) }}"