feat(slice-3): implement Proxmox VE REST API collector with guest agent IP resolution
This commit is contained in:
1 parent
951be389a1
commit
ca9163530f
4 files changed
+361
-1
No files matched your search
@@ -72,6 +72,26 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
for host in collector.collect():
|
||||
inv.add_host(host)
|
||||
|
||||
# Check for Proxmox environment variables
|
||||
import os
|
||||
from inventory_collector.collectors.proxmox import ProxmoxCollector
|
||||
|
||||
pve_url = os.getenv("PROXMOX_URL") or os.getenv("ANSIBLE_PROXMOX_URL")
|
||||
pve_token_id = os.getenv("PROXMOX_TOKEN_ID") or os.getenv("ANSIBLE_PROXMOX_TOKEN_ID")
|
||||
pve_token_secret = os.getenv("PROXMOX_TOKEN_SECRET") or os.getenv("ANSIBLE_PROXMOX_TOKEN_SECRET")
|
||||
verify_ssl = os.getenv("PROXMOX_VERIFY_SSL", "false").lower() in ("true", "1", "yes")
|
||||
|
||||
if pve_url and pve_token_id and pve_token_secret:
|
||||
sys.stderr.write(f"[INFO] Querying Proxmox VE API at {pve_url}...\n")
|
||||
pve_collector = ProxmoxCollector(
|
||||
url=pve_url,
|
||||
token_id=pve_token_id,
|
||||
token_secret=pve_token_secret,
|
||||
verify_ssl=verify_ssl
|
||||
)
|
||||
for host in pve_collector.collect():
|
||||
inv.add_host(host)
|
||||
|
||||
# Tracer bullet fallback if no hosts loaded
|
||||
if not inv.hosts:
|
||||
inv.add_host(HostRecord(
|
||||
|
||||
Reference in new issue
Block a user