https://github.com/victorock/network_inventory
Inventory for Network Devices
https://github.com/victorock/network_inventory
Last synced: 3 months ago
JSON representation
Inventory for Network Devices
- Host: GitHub
- URL: https://github.com/victorock/network_inventory
- Owner: victorock
- Created: 2018-07-30T16:19:52.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-06T20:40:47.000Z (almost 7 years ago)
- Last Synced: 2025-01-11T06:09:57.308Z (4 months ago)
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Ansible Role to Create Network Inventory
=========Ansible role to create network inventory folder/files structure based on device facts.
> NOTE: Inventory is populated based on facts located at: hostvars[inventory_hostname].ansible_facts
Role Variables
--------------Variables are defined in `defaults/main.yml`.
| Name | Default Value | Description |
|-------------------|---------------------|----------------------|
| `autorun` | `False` | Boolean to define if the role "autorun" (`tasks/main.yml`). Useful when you want to have dependencies solved by galaxy (`meta/main.yml`) but don't want it to run automatically. |
| `network_inventory_os` | `{{ ansible_network_os }}` | If ansible_network_os is not set the default is `ios`. |Examples
------------Follow below different examples and ways to use this role.
> 1. Discover the Network Operating System.
```YAML
---
- name: "Network Discovery: PROBE"
hosts: all
connection: local
gather_facts: false
roles:
- role: victorock.network_discovery
network_discovery: "probe"
autorun: true
```> 2. Use Platform specific role to gather facts from Network Operating System.
```YAML
---
- name: "Gather Facts: NXOS"
# This group will be created by previous play who will discover the platforms.
hosts: nxos
connection: network_cli
gather_facts: false
roles:
- role: ansible-network.cisco_nxos
function: get_facts
```> 3. Use Network Inventory role to create inventory Structure.
```YAML
---
- name: "Create Inventory"
hosts: all
connection: local
gather_facts: false
roles:
- role: victorock.network_inventory
autorun: true
```> NOTE: Inventory files are created in the same directory of the playbook
calling the role `victorock.network_inventory`Requirements
--------------The best is to have facts populated by platform specific roles supported by Ansible Networking:
- ansible-network.arista_eos
- ansible-network.cisco_ios
- ansible-network.cisco_nxosLicense
------------GPLv3
Author
------------Victor da Costa (@victorock)