Builds an Ansible inventory from the Proxmox API, grouping VMs by tags
$ pm_inventory_builder -help
Usage of pm_inventory_builder:
-allow-insecure-tls
Allow insecure TLS communication with Proxmox
-ansible-user string
SSH user on which Ansible should attempt to connect
-apiPassword string
Proxmox Password. Can also be set (and is recommended as such) via the PROXMOX_API_PASSWORD environment variable
-apiUser string
Proxmox User. Can also be set via the PROXMOX_API_USERNAME environment variable
-tokenId string
Proxmox Token ID - if this is set, username/password parameters are ignored. Can also be set via the PROXMOX_TOKEN_ID environment variable
-tokenSecret string
Proxmox Token Secret. Can also be set (and is recommended as such) via the PROXMOX_TOKEN_SECRET environment variable
-url string
Proxmox API URL (default "https://localhost:8006")
| Variable | Default |
|---|---|
| PM_IP | 192.168.1.100 |
| PM_PORT | 8006 |
| PM_USER | ubuntu |
| PM_TOKENID | myUser@pve!myToken |
| PM_TOKENSECRET | 44a2085e-f9ae-41c7-a595-d66ece971203 |
Either:
docker run --rm -v "$(pwd)":/data --env-file env.list modem7/pm_inventory_builder:latestOr
Run the following in your console (modifying the values as required):
export PM_IP='192.168.1.100'
export PM_PORT='8006'
export PM_USER='ubuntu'
export PM_TOKENID='myUser@pve!myToken'
export PM_TOKENSECRET='44a2085e-f9ae-41c7-a595-d66ece971203'
docker run --rm -v "$(pwd)":/data -e PM_IP -e PM_PORT -e PM_USER -e PM_TOKENID -e PM_TOKENSECRET modem7/pm_inventory_builder:latest
Once you have run this, you will have a new file created in your directory called my_proxmox_inventory.yaml with your inventory data.
Content type
Image
Digest
sha256:6aa68a92e…
Size
7.4 MB
Last updated
over 3 years ago
docker pull modem7/pm_inventory_builder