netbox-extractor v1.0.1
netbox-extractor
A Crystal CLI that extracts data from Netbox to generate:
- Ansible inventories
- Icinga2 configuration files
- Bind DNS zone files
Installation
Get binary from releases page.
If you use mise you can also install netbox-extractor with asdf-netbox-extractor.
Usage
netbox-extractor <subcommand> <action> [flags...]
| Command | Description |
|---|---|
ansible generate |
Generate Ansible inventory YAML files |
ansible fetch_facts |
Gather Ansible facts into the shared cache |
icinga generate |
Generate Icinga2 configuration files |
bind generate |
Generate Bind DNS zone data |
test_api get |
Check connectivity to the Netbox API |
Common flags:
| Flag | Default | Description |
|---|---|---|
--config, -c |
netbox-extractor.yml |
Path to the config file |
--env, -e |
.env |
Path to the env file |
--site, -s |
all |
Site id to process (all = every site); ansible and icinga only |
Examples:
# Generate Ansible + Icinga config for every configured site
netbox-extractor ansible generate
netbox-extractor icinga generate
# Restrict to one site, with an explicit config path
netbox-extractor icinga generate --site dc1 --config /etc/netbox-extractor.yml
Configuration
netbox-extractor is driven by a YAML config file (netbox-extractor.yml by default) plus an env file (.env) for secrets. See netbox-extractor.yml.example for a complete, loadable example.
- Netbox connection —
netbox.hostname,netbox.portandnetbox.api_token. The token is typically injected from the env file, e.g.api_token: "{{ ENV['NETBOX_TOKEN_API'] }}". - Sites — declared inline under
sites:or loaded from external files listed insites_config:. Each site lists the Netbox device/vm roles to export and, for Icinga, the checks to generate. - Filtering — objects can be included/excluded per site via
include_objectsandexclude_objects. - Tag-driven behavior — the
check-by-snmptag forces SNMP monitoring,check-only-pingrestricts a host to a ping check; OS detection is based on the Netbox platform slug.
Development
Tooling is managed with mise.
mise run dev:deps # Install dependencies (shards install)
mise run dev:build # Compile bin/netbox-extractor
mise run dev:spec # Run tests
mise run dev:ameba # Static analysis (ameba)
mise run dev:format # Format code
bin/netbox-extractor
Contributing
- Fork it (https://github.com/your-github-user/netbox-extractor/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Nicolas Rodriguez - creator and maintainer
Repository
netbox-extractor
Owner
Statistic
- 0
- 0
- 0
- 0
- 8
- 11 days ago
- December 4, 2025
License
MIT License
Links
Synced at
Thu, 16 Jul 2026 02:05:21 GMT
Languages