Sign inSign up

modem7/pm_inventory_builder

By modem7

Updated over 3 years ago

Ansible inventory builder

Image
0

1.0K

modem7/pm_inventory_builder repository overview

pm_inventory_builder

Builds an Ansible inventory from the Proxmox API, grouping VMs by tags

Docker Pulls Docker Image Size (tag) Build Status GitHub latest commit


Usage

$ 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")

Docker

Variables
VariableDefault
PM_IP192.168.1.100
PM_PORT8006
PM_USERubuntu
PM_TOKENIDmyUser@pve!myToken
PM_TOKENSECRET44a2085e-f9ae-41c7-a595-d66ece971203
Running
Environment Variables

Either:

  • Create or copy the env.list file. Modify as required.
  • Run docker run --rm -v "$(pwd)":/data --env-file env.list modem7/pm_inventory_builder:latest

Or

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.

Tag summary

Content type

Image

Digest

sha256:6aa68a92e

Size

7.4 MB

Last updated

over 3 years ago

docker pull modem7/pm_inventory_builder