invctl 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.
Files changed (41) hide show
  1. invctl-0.1.0/.github/workflows/ci.yml +73 -0
  2. invctl-0.1.0/.gitignore +41 -0
  3. invctl-0.1.0/LICENSE +192 -0
  4. invctl-0.1.0/PKG-INFO +210 -0
  5. invctl-0.1.0/README.md +179 -0
  6. invctl-0.1.0/invctl/__init__.py +3 -0
  7. invctl-0.1.0/invctl/client.py +96 -0
  8. invctl-0.1.0/invctl/collectors/__init__.py +23 -0
  9. invctl-0.1.0/invctl/collectors/backups.py +66 -0
  10. invctl-0.1.0/invctl/collectors/base.py +37 -0
  11. invctl-0.1.0/invctl/collectors/cluster.py +81 -0
  12. invctl-0.1.0/invctl/collectors/containers.py +162 -0
  13. invctl-0.1.0/invctl/collectors/firewall.py +187 -0
  14. invctl-0.1.0/invctl/collectors/network.py +91 -0
  15. invctl-0.1.0/invctl/collectors/nodes.py +97 -0
  16. invctl-0.1.0/invctl/collectors/storage.py +101 -0
  17. invctl-0.1.0/invctl/collectors/users.py +131 -0
  18. invctl-0.1.0/invctl/collectors/vms.py +171 -0
  19. invctl-0.1.0/invctl/exporters/__init__.py +7 -0
  20. invctl-0.1.0/invctl/exporters/base.py +16 -0
  21. invctl-0.1.0/invctl/exporters/html_exporter.py +47 -0
  22. invctl-0.1.0/invctl/exporters/json_exporter.py +22 -0
  23. invctl-0.1.0/invctl/exporters/markdown_exporter.py +379 -0
  24. invctl-0.1.0/invctl/main.py +461 -0
  25. invctl-0.1.0/invctl/models.py +405 -0
  26. invctl-0.1.0/invctl/templates/report.html.j2 +638 -0
  27. invctl-0.1.0/pyproject.toml +70 -0
  28. invctl-0.1.0/tests/__init__.py +0 -0
  29. invctl-0.1.0/tests/conftest.py +425 -0
  30. invctl-0.1.0/tests/test_collectors/__init__.py +0 -0
  31. invctl-0.1.0/tests/test_collectors/test_cluster.py +68 -0
  32. invctl-0.1.0/tests/test_collectors/test_containers.py +112 -0
  33. invctl-0.1.0/tests/test_collectors/test_firewall.py +78 -0
  34. invctl-0.1.0/tests/test_collectors/test_nodes.py +69 -0
  35. invctl-0.1.0/tests/test_collectors/test_storage.py +68 -0
  36. invctl-0.1.0/tests/test_collectors/test_users.py +76 -0
  37. invctl-0.1.0/tests/test_collectors/test_vms.py +123 -0
  38. invctl-0.1.0/tests/test_exporters/__init__.py +0 -0
  39. invctl-0.1.0/tests/test_exporters/test_html_exporter.py +120 -0
  40. invctl-0.1.0/tests/test_exporters/test_json_exporter.py +72 -0
  41. invctl-0.1.0/tests/test_exporters/test_markdown_exporter.py +101 -0
@@ -0,0 +1,73 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: ["**"]
6
+ tags: ["v*"]
7
+ pull_request:
8
+ branches: ["**"]
9
+
10
+ jobs:
11
+ lint:
12
+ name: Lint (ruff + mypy)
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: "3.12"
19
+ - name: Install dependencies
20
+ run: pip install -e ".[dev]"
21
+ - name: ruff check
22
+ run: ruff check .
23
+ - name: mypy
24
+ run: mypy invctl/
25
+
26
+ test:
27
+ name: Tests (Python ${{ matrix.python-version }})
28
+ runs-on: ubuntu-latest
29
+ strategy:
30
+ matrix:
31
+ python-version: ["3.11", "3.12"]
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - uses: actions/setup-python@v5
35
+ with:
36
+ python-version: ${{ matrix.python-version }}
37
+ - name: Install dependencies
38
+ run: pip install -e ".[dev]"
39
+ - name: Run tests
40
+ run: pytest --cov=invctl --cov-report=term-missing --cov-report=xml
41
+ - name: Upload coverage
42
+ uses: codecov/codecov-action@v4
43
+ if: matrix.python-version == '3.12'
44
+ with:
45
+ file: ./coverage.xml
46
+ fail_ci_if_error: false
47
+
48
+ publish:
49
+ name: Publish to PyPI + GitHub Release
50
+ needs: [lint, test]
51
+ runs-on: ubuntu-latest
52
+ if: startsWith(github.ref, 'refs/tags/v')
53
+ permissions:
54
+ id-token: write # OIDC Trusted Publisher
55
+ contents: write # create GitHub Release
56
+ steps:
57
+ - uses: actions/checkout@v4
58
+ - uses: actions/setup-python@v5
59
+ with:
60
+ python-version: "3.12"
61
+ - name: Install hatch
62
+ run: pip install hatch
63
+ - name: Build
64
+ run: hatch build
65
+ - name: Publish to PyPI
66
+ uses: pypa/gh-action-pypi-publish@release/v1
67
+ - name: Create GitHub Release
68
+ env:
69
+ GH_TOKEN: ${{ github.token }}
70
+ run: |
71
+ gh release create "${{ github.ref_name }}" dist/* \
72
+ --title "${{ github.ref_name }}" \
73
+ --notes-from-tag
@@ -0,0 +1,41 @@
1
+ # ── Python ────────────────────────────────────────────────────────────────
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyo
5
+ *.pyd
6
+ *.so
7
+ *.egg
8
+ *.egg-info/
9
+ .eggs/
10
+ dist/
11
+ build/
12
+ MANIFEST
13
+
14
+ # ── Virtual environments ──────────────────────────────────────────────────
15
+ .venv/
16
+ venv/
17
+ env/
18
+ ENV/
19
+
20
+ # ── uv ────────────────────────────────────────────────────────────────────
21
+ .uv/
22
+
23
+ # ── Testing ───────────────────────────────────────────────────────────────
24
+ .pytest_cache/
25
+ .coverage
26
+ .coverage.*
27
+ coverage.xml
28
+ htmlcov/
29
+ .tox/
30
+ test-results/
31
+ junit.xml
32
+
33
+ # ── Type checking & linting ───────────────────────────────────────────────
34
+ .mypy_cache/
35
+ .dmypy.json
36
+ dmypy.json
37
+ .ruff_cache/
38
+
39
+ # ── Distribution ──────────────────────────────────────────────────────────
40
+ *.tar.gz
41
+ *.whl
invctl-0.1.0/LICENSE ADDED
@@ -0,0 +1,192 @@
1
+ Copyright 2026 Alexis Frère
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+
15
+ ---
16
+
17
+ Apache License
18
+ Version 2.0, January 2004
19
+ http://www.apache.org/licenses/
20
+
21
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
22
+
23
+ 1. Definitions.
24
+
25
+ "License" shall mean the terms and conditions for use, reproduction,
26
+ and distribution as defined by Sections 1 through 9 of this document.
27
+
28
+ "Licensor" shall mean the copyright owner or entity authorized by
29
+ the copyright owner that is granting the License.
30
+
31
+ "Legal Entity" shall mean the union of the acting entity and all
32
+ other entities that control, are controlled by, or are under common
33
+ control with that entity. For the purposes of this definition,
34
+ "control" means (i) the power, direct or indirect, to cause the
35
+ direction or management of such entity, whether by contract or
36
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
37
+ outstanding shares, or (iii) beneficial ownership of such entity.
38
+
39
+ "You" (or "Your") shall mean an individual or Legal Entity
40
+ exercising permissions granted by this License.
41
+
42
+ "Source" form shall mean the preferred form for making modifications,
43
+ including but not limited to software source code, documentation
44
+ source, and configuration files.
45
+
46
+ "Object" form shall mean any form resulting from mechanical
47
+ transformation or translation of a Source form, including but
48
+ not limited to compiled object code, generated documentation,
49
+ and conversions to other media types.
50
+
51
+ "Work" shall mean the work of authorship, whether in Source or
52
+ Object form, made available under the License, as indicated by a
53
+ copyright notice that is included in or attached to the work
54
+ (an example is provided in the Appendix below).
55
+
56
+ "Derivative Works" shall mean any work, whether in Source or Object
57
+ form, that is based on (or derived from) the Work and for which the
58
+ editorial revisions, annotations, elaborations, or other modifications
59
+ represent, as a whole, an original work of authorship. For the purposes
60
+ of this License, Derivative Works shall not include works that remain
61
+ separable from, or merely link (or bind by name) to the interfaces of,
62
+ the Work and Derivative Works thereof.
63
+
64
+ "Contribution" shall mean any work of authorship, including
65
+ the original version of the Work and any modifications or additions
66
+ to that Work or Derivative Works thereof, that is intentionally
67
+ submitted to Licensor for inclusion in the Work by the copyright owner
68
+ or by an individual or Legal Entity authorized to submit on behalf of
69
+ the copyright owner. For the purposes of this definition, "submitted"
70
+ means any form of electronic, verbal, or written communication sent
71
+ to the Licensor or its representatives, including but not limited to
72
+ communication on electronic mailing lists, source code control systems,
73
+ and issue tracking systems that are managed by, or on behalf of, the
74
+ Licensor for the purpose of discussing and improving the Work, but
75
+ excluding communication that is conspicuously marked or otherwise
76
+ designated in writing by the copyright owner as "Not a Contribution."
77
+
78
+ "Contributor" shall mean Licensor and any individual or Legal Entity
79
+ on behalf of whom a Contribution has been received by Licensor and
80
+ subsequently incorporated within the Work.
81
+
82
+ 2. Grant of Copyright License. Subject to the terms and conditions of
83
+ this License, each Contributor hereby grants to You a perpetual,
84
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
85
+ copyright license to reproduce, prepare Derivative Works of,
86
+ publicly display, publicly perform, sublicense, and distribute the
87
+ Work and such Derivative Works in Source or Object form.
88
+
89
+ 3. Grant of Patent License. Subject to the terms and conditions of
90
+ this License, each Contributor hereby grants to You a perpetual,
91
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
92
+ (except as stated in this section) patent license to make, have made,
93
+ use, offer to sell, sell, import, and otherwise transfer the Work,
94
+ where such license applies only to those patent claims licensable
95
+ by such Contributor that are necessarily infringed by their
96
+ Contribution(s) alone or by combination of their Contribution(s)
97
+ with the Work to which such Contribution(s) was submitted. If You
98
+ institute patent litigation against any entity (including a
99
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
100
+ or a Contribution incorporated within the Work constitutes direct
101
+ or contributory patent infringement, then any patent licenses
102
+ granted to You under this License for that Work shall terminate
103
+ as of the date such litigation is filed.
104
+
105
+ 4. Redistribution. You may reproduce and distribute copies of the
106
+ Work or Derivative Works thereof in any medium, with or without
107
+ modifications, and in Source or Object form, provided that You
108
+ meet the following conditions:
109
+
110
+ (a) You must give any other recipients of the Work or
111
+ Derivative Works a copy of this License; and
112
+
113
+ (b) You must cause any modified files to carry prominent notices
114
+ stating that You changed the files; and
115
+
116
+ (c) You must retain, in the Source form of any Derivative Works
117
+ that You distribute, all copyright, patent, trademark, and
118
+ attribution notices from the Source form of the Work,
119
+ excluding those notices that do not pertain to any part of
120
+ the Derivative Works; and
121
+
122
+ (d) If the Work includes a "NOTICE" text file as part of its
123
+ distribution, then any Derivative Works that You distribute must
124
+ include a readable copy of the attribution notices contained
125
+ within such NOTICE file, excluding those notices that do not
126
+ pertain to any part of the Derivative Works, in at least one
127
+ of the following places: within a NOTICE text file distributed
128
+ as part of the Derivative Works; within the Source form or
129
+ documentation, if provided along with the Derivative Works; or,
130
+ within a display generated by the Derivative Works, if and
131
+ wherever such third-party notices normally appear. The contents
132
+ of the NOTICE file are for informational purposes only and
133
+ do not modify the License. You may add Your own attribution
134
+ notices within Derivative Works that You distribute, alongside
135
+ or as an addendum to the NOTICE text from the Work, provided
136
+ that such additional attribution notices cannot be construed
137
+ as modifying the License.
138
+
139
+ You may add Your own copyright statement to Your modifications and
140
+ may provide additional or different license terms and conditions
141
+ for use, reproduction, or distribution of Your modifications, or
142
+ for any such Derivative Works as a whole, provided Your use,
143
+ reproduction, and distribution of the Work otherwise complies with
144
+ the conditions stated in this License.
145
+
146
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
147
+ any Contribution intentionally submitted for inclusion in the Work
148
+ by You to the Licensor shall be under the terms and conditions of
149
+ this License, without any additional terms or conditions.
150
+ Notwithstanding the above, nothing herein shall supersede or modify
151
+ the terms of any separate license agreement you may have executed
152
+ with Licensor regarding such Contributions.
153
+
154
+ 6. Trademarks. This License does not grant permission to use the trade
155
+ names, trademarks, service marks, or product names of the Licensor,
156
+ except as required for reasonable and customary use in describing the
157
+ origin of the Work and reproducing the content of the NOTICE file.
158
+
159
+ 7. Disclaimer of Warranty. Unless required by applicable law or
160
+ agreed to in writing, Licensor provides the Work (and each
161
+ Contributor provides its Contributions) on an "AS IS" BASIS,
162
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
163
+ implied, including, without limitation, any warranties or conditions
164
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
165
+ PARTICULAR PURPOSE. You are solely responsible for determining the
166
+ appropriateness of using or redistributing the Work and assume any
167
+ risks associated with Your exercise of permissions under this License.
168
+
169
+ 8. Limitation of Liability. In no event and under no legal theory,
170
+ whether in tort (including negligence), contract, or otherwise,
171
+ unless required by applicable law (such as deliberate and grossly
172
+ negligent acts) or agreed to in writing, shall any Contributor be
173
+ liable to You for damages, including any direct, indirect, special,
174
+ incidental, or exemplary damages of any character arising as a result
175
+ of this License or out of the use or inability to use the Work
176
+ (including but not limited to damages for loss of goodwill, work
177
+ stoppage, computer failure or malfunction, or any and all other
178
+ commercial damages or losses), even if such Contributor has been
179
+ advised of the possibility of such damages.
180
+
181
+ 9. Accepting Warranty or Additional Liability. While redistributing
182
+ the Work or Derivative Works thereof, You may choose to offer,
183
+ and charge a fee for, acceptance of support, warranty, indemnity,
184
+ or other liability obligations and/or rights consistent with this
185
+ License. However, in accepting such obligations, You may act only
186
+ on Your own behalf and on your sole responsibility, not on behalf
187
+ of any other Contributor, and only if You agree to indemnify,
188
+ defend, and hold each Contributor harmless for any liability
189
+ incurred by, or claims asserted against, such Contributor by reason
190
+ of your accepting any such warranty or additional liability.
191
+
192
+ END OF TERMS AND CONDITIONS
invctl-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,210 @@
1
+ Metadata-Version: 2.4
2
+ Name: invctl
3
+ Version: 0.1.0
4
+ Summary: Infrastructure Inventory Control for Proxmox VE
5
+ Author-email: Alexis Frère <frere.alexis974@gmail.com>
6
+ License: Apache-2.0
7
+ License-File: LICENSE
8
+ Keywords: devops,infrastructure,inventory,ops,proxmox
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: System Administrators
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Topic :: System :: Systems Administration
16
+ Requires-Python: >=3.11
17
+ Requires-Dist: jinja2>=3.1.0
18
+ Requires-Dist: proxmoxer>=2.0.0
19
+ Requires-Dist: pydantic>=2.0.0
20
+ Requires-Dist: requests>=2.31.0
21
+ Requires-Dist: rich>=13.0.0
22
+ Requires-Dist: typer>=0.12.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: mypy>=1.10.0; extra == 'dev'
25
+ Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
26
+ Requires-Dist: pytest-mock>=3.12.0; extra == 'dev'
27
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
28
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
29
+ Requires-Dist: types-requests>=2.31.0; extra == 'dev'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # invctl — Infrastructure Inventory Control
33
+
34
+ [![CI](https://github.com/frere-alexis/invctl/actions/workflows/ci.yml/badge.svg)](https://github.com/frere-alexis/invctl/actions/workflows/ci.yml)
35
+ [![PyPI](https://img.shields.io/pypi/v/invctl)](https://pypi.org/project/invctl/)
36
+ [![Python](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org/)
37
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
38
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
39
+
40
+ > **Reverse-engineer an undocumented Proxmox VE infrastructure in seconds.**
41
+
42
+ `invctl` connects to the Proxmox API and produces a structured, exportable inventory of every
43
+ layer of the infrastructure — nodes, VMs, containers, storage, networking, backups, users, and
44
+ firewall rules. Designed for ops engineers inheriting a cluster with no runbooks.
45
+
46
+ The author is a contributor to [proxmoxer](https://github.com/proxmoxer/proxmoxer), the
47
+ underlying Proxmox API client library.
48
+
49
+ ---
50
+
51
+ ## Features
52
+
53
+ | Section | What's collected |
54
+ |---|---|
55
+ | **Cluster** | Name, quorum status, HA state and groups |
56
+ | **Nodes** | Hardware (CPU model, sockets, cores), memory, kernel, PVE version, subscription |
57
+ | **Virtual Machines** | Config (CPU, RAM, disks, networks, BIOS, agent), runtime stats, snapshots, tags |
58
+ | **LXC Containers** | Config (CPU, RAM, swap, rootfs, mountpoints, networks), runtime stats, snapshots, tags |
59
+ | **Storage** | All backends (dir/nfs/cifs/lvmthin/zfspool/ceph/…), content types, per-node usage |
60
+ | **Network** | Bridges, bonds, VLANs per node with IP/CIDR, ports, STP, VLAN-aware flag |
61
+ | **Backups** | All vzdump jobs: schedule, targets, mode, retention policy |
62
+ | **Users & Access** | Users, groups, roles, ACLs, authentication realms |
63
+ | **Firewall** | Cluster policy, security groups, per-node and per-VM/CT rules |
64
+ | **diff** | Compare two snapshots: added/removed VMs & CTs, config changes, storage drift, user changes |
65
+
66
+ ---
67
+
68
+ ## Prerequisites
69
+
70
+ ### Proxmox API token (recommended)
71
+
72
+ 1. Go to **Datacenter → Permissions → API Tokens** in the web UI
73
+ 2. Click **Add** — select the user, set a token ID, uncheck **Privilege Separation** for full
74
+ read access (or scope it to `VM.Audit`, `Datastore.Audit`, etc. for least privilege)
75
+ 3. Copy the token secret — shown only once
76
+
77
+ ### Required API privileges (read-only scan)
78
+
79
+ | Privilege | Used by |
80
+ |---|---|
81
+ | `VM.Audit` | VMs, containers |
82
+ | `Datastore.Audit` | Storage |
83
+ | `Sys.Audit` | Nodes, network |
84
+ | `Permissions.Read` | Users, ACLs, roles |
85
+
86
+ ---
87
+
88
+ ## Install
89
+
90
+ ```bash
91
+ pip install invctl
92
+ ```
93
+
94
+ With [uv](https://github.com/astral-sh/uv):
95
+
96
+ ```bash
97
+ uv tool install invctl
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Configuration
103
+
104
+ All CLI flags have environment variable equivalents:
105
+
106
+ | Env var | Flag | Description |
107
+ |---|---|---|
108
+ | `PROXMOX_HOST` | `--host` | Proxmox hostname or IP |
109
+ | `PROXMOX_TOKEN_ID` | `--token-id` | API token ID (`user@realm!tokenname`) |
110
+ | `PROXMOX_TOKEN_SECRET` | `--token-secret` | API token secret |
111
+ | `PROXMOX_USER` | `--user` | Username for password auth |
112
+ | `PROXMOX_PASSWORD` | `--password` | Password for password auth |
113
+
114
+ Store credentials in a `.env` file and source it:
115
+
116
+ ```bash
117
+ # .env
118
+ PROXMOX_HOST=pve.example.com
119
+ PROXMOX_TOKEN_ID=root@pam!invctl
120
+ PROXMOX_TOKEN_SECRET=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
121
+ ```
122
+
123
+ ```bash
124
+ source .env && invctl scan
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Usage
130
+
131
+ ### Full scan to JSON
132
+
133
+ ```bash
134
+ invctl scan --host pve.example.com \
135
+ --token-id root@pam!invctl \
136
+ --token-secret <secret>
137
+ ```
138
+
139
+ ### Save a dated snapshot
140
+
141
+ ```bash
142
+ invctl scan --output json --file "inventory-$(date +%Y%m%d).json"
143
+ ```
144
+
145
+ ### HTML report
146
+
147
+ ```bash
148
+ invctl scan --output html --file report.html && open report.html
149
+ ```
150
+
151
+ ### Markdown report
152
+
153
+ ```bash
154
+ invctl scan --output markdown --file INFRA.md
155
+ ```
156
+
157
+ ### Collect specific sections only
158
+
159
+ ```bash
160
+ invctl scan --sections vms,containers
161
+ invctl scan --sections users,firewall --output markdown
162
+ ```
163
+
164
+ ### Diff two snapshots
165
+
166
+ ```bash
167
+ invctl diff inventory-20240101.json inventory-20240201.json
168
+ invctl diff old.json new.json --output json | jq '.vms.added'
169
+ invctl diff old.json new.json --output markdown
170
+ ```
171
+
172
+ ### Self-signed certificate
173
+
174
+ ```bash
175
+ invctl scan --host 192.168.1.10 --no-verify-ssl
176
+ ```
177
+
178
+ ### CLI reference
179
+
180
+ ```
181
+ invctl scan [OPTIONS]
182
+
183
+ --host TEXT [env: PROXMOX_HOST]
184
+ --token-id TEXT [env: PROXMOX_TOKEN_ID]
185
+ --token-secret TEXT [env: PROXMOX_TOKEN_SECRET]
186
+ --user TEXT [env: PROXMOX_USER]
187
+ --password TEXT [env: PROXMOX_PASSWORD]
188
+ --port INT Default: 8006
189
+ --no-verify-ssl
190
+ --output [json|html|markdown] Default: json
191
+ --file PATH
192
+ --sections TEXT cluster,nodes,vms,containers,
193
+ storage,network,backups,users,firewall
194
+ --pretty / --no-pretty Default: --pretty
195
+
196
+ invctl diff FILE1 FILE2 [OPTIONS]
197
+
198
+ --output [text|json|markdown] Default: text
199
+ ```
200
+
201
+ ---
202
+
203
+ ## Contributing
204
+
205
+ Contributions are welcome — open an issue or pull request on GitHub.
206
+
207
+ For a guide on how the codebase is structured, how the CI works, and how to add new collectors
208
+ or exporters, see [ARCHITECTURE.md](ARCHITECTURE.md).
209
+
210
+ Please make sure `ruff check .` and `mypy invctl/` pass before submitting a PR.
invctl-0.1.0/README.md ADDED
@@ -0,0 +1,179 @@
1
+ # invctl — Infrastructure Inventory Control
2
+
3
+ [![CI](https://github.com/frere-alexis/invctl/actions/workflows/ci.yml/badge.svg)](https://github.com/frere-alexis/invctl/actions/workflows/ci.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/invctl)](https://pypi.org/project/invctl/)
5
+ [![Python](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org/)
6
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
7
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
8
+
9
+ > **Reverse-engineer an undocumented Proxmox VE infrastructure in seconds.**
10
+
11
+ `invctl` connects to the Proxmox API and produces a structured, exportable inventory of every
12
+ layer of the infrastructure — nodes, VMs, containers, storage, networking, backups, users, and
13
+ firewall rules. Designed for ops engineers inheriting a cluster with no runbooks.
14
+
15
+ The author is a contributor to [proxmoxer](https://github.com/proxmoxer/proxmoxer), the
16
+ underlying Proxmox API client library.
17
+
18
+ ---
19
+
20
+ ## Features
21
+
22
+ | Section | What's collected |
23
+ |---|---|
24
+ | **Cluster** | Name, quorum status, HA state and groups |
25
+ | **Nodes** | Hardware (CPU model, sockets, cores), memory, kernel, PVE version, subscription |
26
+ | **Virtual Machines** | Config (CPU, RAM, disks, networks, BIOS, agent), runtime stats, snapshots, tags |
27
+ | **LXC Containers** | Config (CPU, RAM, swap, rootfs, mountpoints, networks), runtime stats, snapshots, tags |
28
+ | **Storage** | All backends (dir/nfs/cifs/lvmthin/zfspool/ceph/…), content types, per-node usage |
29
+ | **Network** | Bridges, bonds, VLANs per node with IP/CIDR, ports, STP, VLAN-aware flag |
30
+ | **Backups** | All vzdump jobs: schedule, targets, mode, retention policy |
31
+ | **Users & Access** | Users, groups, roles, ACLs, authentication realms |
32
+ | **Firewall** | Cluster policy, security groups, per-node and per-VM/CT rules |
33
+ | **diff** | Compare two snapshots: added/removed VMs & CTs, config changes, storage drift, user changes |
34
+
35
+ ---
36
+
37
+ ## Prerequisites
38
+
39
+ ### Proxmox API token (recommended)
40
+
41
+ 1. Go to **Datacenter → Permissions → API Tokens** in the web UI
42
+ 2. Click **Add** — select the user, set a token ID, uncheck **Privilege Separation** for full
43
+ read access (or scope it to `VM.Audit`, `Datastore.Audit`, etc. for least privilege)
44
+ 3. Copy the token secret — shown only once
45
+
46
+ ### Required API privileges (read-only scan)
47
+
48
+ | Privilege | Used by |
49
+ |---|---|
50
+ | `VM.Audit` | VMs, containers |
51
+ | `Datastore.Audit` | Storage |
52
+ | `Sys.Audit` | Nodes, network |
53
+ | `Permissions.Read` | Users, ACLs, roles |
54
+
55
+ ---
56
+
57
+ ## Install
58
+
59
+ ```bash
60
+ pip install invctl
61
+ ```
62
+
63
+ With [uv](https://github.com/astral-sh/uv):
64
+
65
+ ```bash
66
+ uv tool install invctl
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Configuration
72
+
73
+ All CLI flags have environment variable equivalents:
74
+
75
+ | Env var | Flag | Description |
76
+ |---|---|---|
77
+ | `PROXMOX_HOST` | `--host` | Proxmox hostname or IP |
78
+ | `PROXMOX_TOKEN_ID` | `--token-id` | API token ID (`user@realm!tokenname`) |
79
+ | `PROXMOX_TOKEN_SECRET` | `--token-secret` | API token secret |
80
+ | `PROXMOX_USER` | `--user` | Username for password auth |
81
+ | `PROXMOX_PASSWORD` | `--password` | Password for password auth |
82
+
83
+ Store credentials in a `.env` file and source it:
84
+
85
+ ```bash
86
+ # .env
87
+ PROXMOX_HOST=pve.example.com
88
+ PROXMOX_TOKEN_ID=root@pam!invctl
89
+ PROXMOX_TOKEN_SECRET=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
90
+ ```
91
+
92
+ ```bash
93
+ source .env && invctl scan
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Usage
99
+
100
+ ### Full scan to JSON
101
+
102
+ ```bash
103
+ invctl scan --host pve.example.com \
104
+ --token-id root@pam!invctl \
105
+ --token-secret <secret>
106
+ ```
107
+
108
+ ### Save a dated snapshot
109
+
110
+ ```bash
111
+ invctl scan --output json --file "inventory-$(date +%Y%m%d).json"
112
+ ```
113
+
114
+ ### HTML report
115
+
116
+ ```bash
117
+ invctl scan --output html --file report.html && open report.html
118
+ ```
119
+
120
+ ### Markdown report
121
+
122
+ ```bash
123
+ invctl scan --output markdown --file INFRA.md
124
+ ```
125
+
126
+ ### Collect specific sections only
127
+
128
+ ```bash
129
+ invctl scan --sections vms,containers
130
+ invctl scan --sections users,firewall --output markdown
131
+ ```
132
+
133
+ ### Diff two snapshots
134
+
135
+ ```bash
136
+ invctl diff inventory-20240101.json inventory-20240201.json
137
+ invctl diff old.json new.json --output json | jq '.vms.added'
138
+ invctl diff old.json new.json --output markdown
139
+ ```
140
+
141
+ ### Self-signed certificate
142
+
143
+ ```bash
144
+ invctl scan --host 192.168.1.10 --no-verify-ssl
145
+ ```
146
+
147
+ ### CLI reference
148
+
149
+ ```
150
+ invctl scan [OPTIONS]
151
+
152
+ --host TEXT [env: PROXMOX_HOST]
153
+ --token-id TEXT [env: PROXMOX_TOKEN_ID]
154
+ --token-secret TEXT [env: PROXMOX_TOKEN_SECRET]
155
+ --user TEXT [env: PROXMOX_USER]
156
+ --password TEXT [env: PROXMOX_PASSWORD]
157
+ --port INT Default: 8006
158
+ --no-verify-ssl
159
+ --output [json|html|markdown] Default: json
160
+ --file PATH
161
+ --sections TEXT cluster,nodes,vms,containers,
162
+ storage,network,backups,users,firewall
163
+ --pretty / --no-pretty Default: --pretty
164
+
165
+ invctl diff FILE1 FILE2 [OPTIONS]
166
+
167
+ --output [text|json|markdown] Default: text
168
+ ```
169
+
170
+ ---
171
+
172
+ ## Contributing
173
+
174
+ Contributions are welcome — open an issue or pull request on GitHub.
175
+
176
+ For a guide on how the codebase is structured, how the CI works, and how to add new collectors
177
+ or exporters, see [ARCHITECTURE.md](ARCHITECTURE.md).
178
+
179
+ Please make sure `ruff check .` and `mypy invctl/` pass before submitting a PR.