ign8inventory 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ign8inventory-0.1.0/LICENSE +21 -0
- ign8inventory-0.1.0/PKG-INFO +136 -0
- ign8inventory-0.1.0/README.md +92 -0
- ign8inventory-0.1.0/pyproject.toml +75 -0
- ign8inventory-0.1.0/src/ign8inventory/__init__.py +0 -0
- ign8inventory-0.1.0/src/ign8inventory/cli.py +603 -0
- ign8inventory-0.1.0/src/ign8inventory/config.py +33 -0
- ign8inventory-0.1.0/src/ign8inventory/dns/__init__.py +0 -0
- ign8inventory-0.1.0/src/ign8inventory/dns/cloudflare.py +37 -0
- ign8inventory-0.1.0/src/ign8inventory/infra/__init__.py +0 -0
- ign8inventory-0.1.0/src/ign8inventory/infra/hetzner.py +109 -0
- ign8inventory-0.1.0/src/ign8inventory/keys.py +48 -0
- ign8inventory-0.1.0/src/ign8inventory/setup/__init__.py +0 -0
- ign8inventory-0.1.0/src/ign8inventory/setup/netbox.py +308 -0
- ign8inventory-0.1.0/src/ign8inventory/setup/server.py +361 -0
- ign8inventory-0.1.0/src/ign8inventory/vault.py +152 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Jakob Holst
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ign8inventory
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Spin up a NetBox inventory environment in minutes — Hetzner Cloud, Cloudflare DNS, opinionated regions/sites/locations.
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: netbox,hetzner,inventory,dcim,ipam,infrastructure
|
|
8
|
+
Author: Jakob Holst
|
|
9
|
+
Author-email: lyngknuden@gmail.com
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: System Administrators
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: System :: Systems Administration
|
|
24
|
+
Classifier: Topic :: Internet :: Name Service (DNS)
|
|
25
|
+
Classifier: Topic :: Utilities
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: cloudflare (>=3)
|
|
28
|
+
Requires-Dist: cryptography (>=42)
|
|
29
|
+
Requires-Dist: hcloud (>=2)
|
|
30
|
+
Requires-Dist: mypy (>=1.10) ; extra == "dev"
|
|
31
|
+
Requires-Dist: paramiko (>=3)
|
|
32
|
+
Requires-Dist: pydantic (>=2)
|
|
33
|
+
Requires-Dist: pydantic-settings (>=2)
|
|
34
|
+
Requires-Dist: pytest (>=8) ; extra == "dev"
|
|
35
|
+
Requires-Dist: pyyaml (>=6)
|
|
36
|
+
Requires-Dist: rich (>=13)
|
|
37
|
+
Requires-Dist: ruff (>=0.4) ; extra == "dev"
|
|
38
|
+
Requires-Dist: typer (>=0.12)
|
|
39
|
+
Project-URL: Bug Tracker, https://github.com/team-nine/ign8inventory/issues
|
|
40
|
+
Project-URL: Homepage, https://github.com/team-nine/ign8inventory
|
|
41
|
+
Project-URL: Repository, https://github.com/team-nine/ign8inventory
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
|
|
44
|
+
# ign8inventory
|
|
45
|
+
|
|
46
|
+
**Provision a production-ready [NetBox](https://netbox.dev/) DCIM/IPAM instance in minutes** — Hetzner Cloud VM, Cloudflare DNS, Let's Encrypt TLS, PostgreSQL, and an opinionated default layout, all from a single CLI command.
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
pip install ign8inventory
|
|
50
|
+
ign8inventory setenv # configure credentials
|
|
51
|
+
ign8inventory up # provision everything
|
|
52
|
+
ign8inventory bootstrap # populate regions, sites, locations
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Features
|
|
56
|
+
|
|
57
|
+
- **Single command provisioning** — one `ign8inventory up` creates the Hetzner VM, DNS record, TLS certificate, and a fully configured NetBox instance
|
|
58
|
+
- **Idempotent** — re-running any command is safe; existing resources are detected and reused
|
|
59
|
+
- **No Terraform, no Ansible** — pure Python using the official Hetzner and Cloudflare SDKs
|
|
60
|
+
- **Database backup** — `ign8inventory backup` exports the PostgreSQL database via SSH and commits it to your repository
|
|
61
|
+
- **Live server seeding** — `ign8inventory seed` queries your Hetzner projects and upserts running servers into NetBox
|
|
62
|
+
- **Vault integration** — secrets in `infrastructure.yml` can be stored in and resolved from HashiCorp Vault
|
|
63
|
+
|
|
64
|
+
## Requirements
|
|
65
|
+
|
|
66
|
+
- Python 3.9+
|
|
67
|
+
- A [Hetzner Cloud](https://www.hetzner.com/cloud) account and API token
|
|
68
|
+
- A [Cloudflare](https://cloudflare.com) account managing your domain, with a Zone DNS Edit token
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pipx install ign8inventory # recommended
|
|
74
|
+
# or
|
|
75
|
+
pip install ign8inventory
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Quickstart
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# 1. Configure — writes a .env file with all credentials
|
|
82
|
+
ign8inventory setenv
|
|
83
|
+
|
|
84
|
+
# 2. Provision — Hetzner VM + Cloudflare DNS + TLS + NetBox
|
|
85
|
+
ign8inventory up
|
|
86
|
+
|
|
87
|
+
# 3. Bootstrap — create regions, sites, and availability zones
|
|
88
|
+
ign8inventory bootstrap
|
|
89
|
+
|
|
90
|
+
# 4. Backup — export the database and commit it
|
|
91
|
+
ign8inventory backup
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Run `ign8inventory quickstart` for the full step-by-step guide.
|
|
95
|
+
|
|
96
|
+
## Commands
|
|
97
|
+
|
|
98
|
+
| Command | Description |
|
|
99
|
+
|---------|-------------|
|
|
100
|
+
| `up` | Provision Hetzner VM, Cloudflare DNS, TLS, and install NetBox |
|
|
101
|
+
| `bootstrap` | Populate NetBox with regions, sites, and locations |
|
|
102
|
+
| `seed` | Query live Hetzner projects and upsert servers into NetBox |
|
|
103
|
+
| `backup` | Export the PostgreSQL database via SSH, save to `backup/netbox.sql`, and commit |
|
|
104
|
+
| `show-users` | List all NetBox users |
|
|
105
|
+
| `add-user` | Create a new NetBox user |
|
|
106
|
+
| `vault-put` | Push `infrastructure.yml` secrets to HashiCorp Vault |
|
|
107
|
+
| `setenv` | Interactive credential setup — writes `.env` |
|
|
108
|
+
| `destroy` | Tear down the server and DNS records |
|
|
109
|
+
|
|
110
|
+
## Default layout
|
|
111
|
+
|
|
112
|
+
`ign8inventory bootstrap` creates:
|
|
113
|
+
|
|
114
|
+
- **Regions**: Europe, North America, Asia Pacific
|
|
115
|
+
- **Sites**: nbg1, fsn1, hel1 (EU) · ash1, hil1 (US) · sin1 (APAC)
|
|
116
|
+
- **Locations**: zone-a, zone-b per site
|
|
117
|
+
|
|
118
|
+
## Environment variables
|
|
119
|
+
|
|
120
|
+
| Variable | Description |
|
|
121
|
+
|----------|-------------|
|
|
122
|
+
| `IGN8_DOMAIN` | Base domain — `inventory.DOMAIN` will be created |
|
|
123
|
+
| `IGN8_ADMIN_EMAIL` | Contact email for Let's Encrypt |
|
|
124
|
+
| `IGN8_HETZNER_TOKEN` | Hetzner Cloud API token |
|
|
125
|
+
| `IGN8_CLOUDFLARE_TOKEN` | Cloudflare API token (Zone DNS Edit) |
|
|
126
|
+
| `IGN8_CLOUDFLARE_ZONE_ID` | Cloudflare Zone ID |
|
|
127
|
+
| `IGN8_NETBOX_SUPERUSER` | NetBox admin username (default: `admin`) |
|
|
128
|
+
| `IGN8_NETBOX_PASSWORD` | NetBox admin password |
|
|
129
|
+
| `IGN8_NETBOX_TOKEN` | API token — filled in after `up`, used by `bootstrap` and `seed` |
|
|
130
|
+
|
|
131
|
+
All variables can also be set via a `.env` file or passed as CLI flags.
|
|
132
|
+
|
|
133
|
+
## License
|
|
134
|
+
|
|
135
|
+
MIT
|
|
136
|
+
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# ign8inventory
|
|
2
|
+
|
|
3
|
+
**Provision a production-ready [NetBox](https://netbox.dev/) DCIM/IPAM instance in minutes** — Hetzner Cloud VM, Cloudflare DNS, Let's Encrypt TLS, PostgreSQL, and an opinionated default layout, all from a single CLI command.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
pip install ign8inventory
|
|
7
|
+
ign8inventory setenv # configure credentials
|
|
8
|
+
ign8inventory up # provision everything
|
|
9
|
+
ign8inventory bootstrap # populate regions, sites, locations
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- **Single command provisioning** — one `ign8inventory up` creates the Hetzner VM, DNS record, TLS certificate, and a fully configured NetBox instance
|
|
15
|
+
- **Idempotent** — re-running any command is safe; existing resources are detected and reused
|
|
16
|
+
- **No Terraform, no Ansible** — pure Python using the official Hetzner and Cloudflare SDKs
|
|
17
|
+
- **Database backup** — `ign8inventory backup` exports the PostgreSQL database via SSH and commits it to your repository
|
|
18
|
+
- **Live server seeding** — `ign8inventory seed` queries your Hetzner projects and upserts running servers into NetBox
|
|
19
|
+
- **Vault integration** — secrets in `infrastructure.yml` can be stored in and resolved from HashiCorp Vault
|
|
20
|
+
|
|
21
|
+
## Requirements
|
|
22
|
+
|
|
23
|
+
- Python 3.9+
|
|
24
|
+
- A [Hetzner Cloud](https://www.hetzner.com/cloud) account and API token
|
|
25
|
+
- A [Cloudflare](https://cloudflare.com) account managing your domain, with a Zone DNS Edit token
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pipx install ign8inventory # recommended
|
|
31
|
+
# or
|
|
32
|
+
pip install ign8inventory
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quickstart
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# 1. Configure — writes a .env file with all credentials
|
|
39
|
+
ign8inventory setenv
|
|
40
|
+
|
|
41
|
+
# 2. Provision — Hetzner VM + Cloudflare DNS + TLS + NetBox
|
|
42
|
+
ign8inventory up
|
|
43
|
+
|
|
44
|
+
# 3. Bootstrap — create regions, sites, and availability zones
|
|
45
|
+
ign8inventory bootstrap
|
|
46
|
+
|
|
47
|
+
# 4. Backup — export the database and commit it
|
|
48
|
+
ign8inventory backup
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Run `ign8inventory quickstart` for the full step-by-step guide.
|
|
52
|
+
|
|
53
|
+
## Commands
|
|
54
|
+
|
|
55
|
+
| Command | Description |
|
|
56
|
+
|---------|-------------|
|
|
57
|
+
| `up` | Provision Hetzner VM, Cloudflare DNS, TLS, and install NetBox |
|
|
58
|
+
| `bootstrap` | Populate NetBox with regions, sites, and locations |
|
|
59
|
+
| `seed` | Query live Hetzner projects and upsert servers into NetBox |
|
|
60
|
+
| `backup` | Export the PostgreSQL database via SSH, save to `backup/netbox.sql`, and commit |
|
|
61
|
+
| `show-users` | List all NetBox users |
|
|
62
|
+
| `add-user` | Create a new NetBox user |
|
|
63
|
+
| `vault-put` | Push `infrastructure.yml` secrets to HashiCorp Vault |
|
|
64
|
+
| `setenv` | Interactive credential setup — writes `.env` |
|
|
65
|
+
| `destroy` | Tear down the server and DNS records |
|
|
66
|
+
|
|
67
|
+
## Default layout
|
|
68
|
+
|
|
69
|
+
`ign8inventory bootstrap` creates:
|
|
70
|
+
|
|
71
|
+
- **Regions**: Europe, North America, Asia Pacific
|
|
72
|
+
- **Sites**: nbg1, fsn1, hel1 (EU) · ash1, hil1 (US) · sin1 (APAC)
|
|
73
|
+
- **Locations**: zone-a, zone-b per site
|
|
74
|
+
|
|
75
|
+
## Environment variables
|
|
76
|
+
|
|
77
|
+
| Variable | Description |
|
|
78
|
+
|----------|-------------|
|
|
79
|
+
| `IGN8_DOMAIN` | Base domain — `inventory.DOMAIN` will be created |
|
|
80
|
+
| `IGN8_ADMIN_EMAIL` | Contact email for Let's Encrypt |
|
|
81
|
+
| `IGN8_HETZNER_TOKEN` | Hetzner Cloud API token |
|
|
82
|
+
| `IGN8_CLOUDFLARE_TOKEN` | Cloudflare API token (Zone DNS Edit) |
|
|
83
|
+
| `IGN8_CLOUDFLARE_ZONE_ID` | Cloudflare Zone ID |
|
|
84
|
+
| `IGN8_NETBOX_SUPERUSER` | NetBox admin username (default: `admin`) |
|
|
85
|
+
| `IGN8_NETBOX_PASSWORD` | NetBox admin password |
|
|
86
|
+
| `IGN8_NETBOX_TOKEN` | API token — filled in after `up`, used by `bootstrap` and `seed` |
|
|
87
|
+
|
|
88
|
+
All variables can also be set via a `.env` file or passed as CLI flags.
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
MIT
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["poetry-core>=2.0.0"]
|
|
3
|
+
build-backend = "poetry.core.masonry.api"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ign8inventory"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Spin up a NetBox inventory environment in minutes — Hetzner Cloud, Cloudflare DNS, opinionated regions/sites/locations."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Jakob Holst", email = "lyngknuden@gmail.com" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["netbox", "hetzner", "inventory", "dcim", "ipam", "infrastructure"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
"Intended Audience :: System Administrators",
|
|
20
|
+
"Intended Audience :: Developers",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3.9",
|
|
25
|
+
"Programming Language :: Python :: 3.10",
|
|
26
|
+
"Programming Language :: Python :: 3.11",
|
|
27
|
+
"Programming Language :: Python :: 3.12",
|
|
28
|
+
"Programming Language :: Python :: 3.13",
|
|
29
|
+
"Topic :: System :: Systems Administration",
|
|
30
|
+
"Topic :: Internet :: Name Service (DNS)",
|
|
31
|
+
"Topic :: Utilities",
|
|
32
|
+
]
|
|
33
|
+
dependencies = [
|
|
34
|
+
"typer>=0.12",
|
|
35
|
+
"rich>=13",
|
|
36
|
+
"hcloud>=2",
|
|
37
|
+
"cloudflare>=3",
|
|
38
|
+
"paramiko>=3",
|
|
39
|
+
"pydantic>=2",
|
|
40
|
+
"pydantic-settings>=2",
|
|
41
|
+
"cryptography>=42",
|
|
42
|
+
"pyyaml>=6",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[project.urls]
|
|
46
|
+
Homepage = "https://github.com/team-nine/ign8inventory"
|
|
47
|
+
Repository = "https://github.com/team-nine/ign8inventory"
|
|
48
|
+
"Bug Tracker" = "https://github.com/team-nine/ign8inventory/issues"
|
|
49
|
+
|
|
50
|
+
[project.scripts]
|
|
51
|
+
ign8inventory = "ign8inventory.cli:app"
|
|
52
|
+
|
|
53
|
+
[project.optional-dependencies]
|
|
54
|
+
dev = [
|
|
55
|
+
"pytest>=8",
|
|
56
|
+
"ruff>=0.4",
|
|
57
|
+
"mypy>=1.10",
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
[tool.poetry]
|
|
61
|
+
packages = [{include = "ign8inventory", from = "src"}]
|
|
62
|
+
|
|
63
|
+
[tool.ruff]
|
|
64
|
+
src = ["src"]
|
|
65
|
+
line-length = 100
|
|
66
|
+
|
|
67
|
+
[tool.ruff.lint]
|
|
68
|
+
select = ["E", "F", "I", "UP"]
|
|
69
|
+
|
|
70
|
+
[tool.mypy]
|
|
71
|
+
strict = true
|
|
72
|
+
mypy_path = "src"
|
|
73
|
+
|
|
74
|
+
[tool.pytest.ini_options]
|
|
75
|
+
testpaths = ["tests"]
|
|
File without changes
|