- Python 86.6%
- Jinja 7.3%
- Shell 6.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| .vibe | ||
| files | ||
| handlers | ||
| roles/provisioner | ||
| tasks | ||
| templates | ||
| tests | ||
| .clinerules | ||
| .cursorrules | ||
| .windsurfrules | ||
| AGENTS.md | ||
| CHANGELOG.md | ||
| CLAUDE.md | ||
| GEMINI.md | ||
| iac.json | ||
| LICENSE | ||
| README.md | ||
iac-netbox
IP Address Management (IPAM) and Data Center Infrastructure Management (DCIM) with NetBox as an LXC container or VM on Proxmox VE. Part of iac.
Features
- Repeatable Deployment: Powered by
iac-corewith automated setup of Python venv, PostgreSQL client libraries, Redis, and Gunicorn. - Clean Release Management: Versions are isolated in
/opt/netbox-x.y.z/and swapped atomically via/opt/netboxsymlink. - Persistent Storage: Uploads (
media), custom scripts (scripts), and reports (reports) reside safely outside the app directory in/var/lib/netbox/. - Web server: nginx serves the Web UI on port
8000including the static files; Gunicorn only listens on127.0.0.1:8001. Own nginx additions:/etc/nginx/conf.d/*.conf. - Automated Firewalling: Port
8000(Web UI) is managed directly viaiac.json.
Installation (on the Proxmox Node)
bash -c "$(curl -fsSL https://iac.heyer.systems/netbox/ct.sh)" # LXC
bash -c "$(curl -fsSL https://iac.heyer.systems/netbox/vm.sh)" # VM
For non-interactive automation, supply IAC_NONINTERACTIVE=1 along with var_* environment variables. The easiest way to generate these is through the web form at:
https://iac.heyer.systems/apps/netbox/
First login
User admin, the password is generated per instance – inside the guest:
grep netbox_admin_password /etc/iac/settings.env
The user is only created while NetBox has no superuser at all; change the password after the first login.
Custom Configuration
The primary configuration is managed by iac. Place your local customizations (such as a custom SECRET_KEY, database settings, or LDAP configurations) into the override file so they survive updates:
/etc/netbox/configuration.local.py
iac-provisioner
The module provisioner adds the NetBox schema that iac-provisioner needs: the tags iac-managed, iac-update-now, iac-security-report-now and iac-reboot-now, the custom fields iac_app, iac_type, iac_modules, iac_vmid, iac_settings, iac_firewall (virtual machines) and gateway (prefixes) and their choice sets, the read-only fields of the group "iac status" (app version, last update, configuration, settings, packages, CVEs, security report, reboot needed, services to restart), the field "Accepted risks" (group "compliance": residual risks iac-compliance reports as accepted until their date, one per line <CVE or check> | <until> | <responsible> | <reason>), the field "Availability target" (iac_slo, group "compliance": 99.0, 99.5 or 99.9 %, default 99.5 – iac-compliance rates the availability of the server over 28 days against it), the platforms of the guest OSes (iac-core os.json, e.g. "Debian 13", "Home Assistant OS" – iac-provisioner sets them on the VMs) and the config context profile iac, which checks iac.guest (settings and firewall) when a config context is saved. The validator also checks the fields Settings and Firewall of a VM: their format, settings the app or a module knows, no secrets, SSH not closed – and the format of Accepted risks. A custom validator refuses an app or a module that does not exist for the chosen type (e.g. the AI workstation as LXC) when a VM is saved, and Modules, Settings or Firewall of an app whose guest OS iac does not configure inside (e.g. Home Assistant OS, os.json of iac-core); the choices show the platforms, e.g. "AI-Workstation (VM)". Choose it at creation (var_modules=provisioner) or add it later:
update --add-modules provisioner
Removing the module keeps the schema – deleting the custom fields would delete their values.
SSH button on the VM page
The schema also creates the custom link iac_ssh: a blue button "SSH" on every virtual machine with a primary IP, pointing to ssh://root@<primary IP>. New machines get it at once, there is no session list to keep up to date. Edit or disable it under Customization → Custom Links; the schema does not overwrite changes.
The browser needs a handler for ssh:// that starts PuTTY. On Windows import this once per workstation (adjust the path to putty.exe; save as .reg):
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\ssh]
@="URL:SSH Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\ssh\shell\open\command]
@="powershell.exe -NoProfile -WindowStyle Hidden -Command \"& 'C:\\Program Files\\PuTTY\\putty.exe' -ssh ('%1' -replace '^ssh://','' -replace '/$','')\""
PuTTY does not take ssh:// URLs itself, so the handler turns ssh://root@192.0.2.10 into -ssh root@192.0.2.10. The browser asks once whether it may open the application.
PuTTY only talks to Pageant. If the keys live in an agent that offers the Windows OpenSSH pipe (e.g. the SSH agent of Bitwarden), bridge it once per workstation: winget install winssh-pageant.
Maintenance & Updates (inside the guest)
Fetches the latest NetBox release from GitHub, applies database migrations, runs collectstatic, and restarts services safely:
update
Self-Test (inside the guest)
Validates the Python virtualenv, Gunicorn processes, Django system health, and the RQ worker:
bash /var/lib/iac/src/core/bin/iac-smoke