Skip to content

Instantly share code, notes, and snippets.

@cswingler
Last active October 12, 2021 04:22
Show Gist options
  • Save cswingler/47479933851f10d25277bc414255c3f6 to your computer and use it in GitHub Desktop.
Save cswingler/47479933851f10d25277bc414255c3f6 to your computer and use it in GitHub Desktop.
notes on the proxmox ansible inventory thing

so if you're trying to use the community.general.proxmox plugin:

first, install it:

ansible-galaxy collection install community.general
[inventory]
enable_plugins = community.general.proxmox

and getting an empty resultset back (or just the promox node itself), you probably need to update the user to have full access.

Assuming you've created a user named "anisble" in the "pve" realm through the UI, do this on your Proxmox server:

pveum aclmod / -user ansible@pve -role PVEAdmin

By default that user can't do anything other than log in, and needs that role in order to enumerate everything.

Once you've done that, and created a <something>.proxmox.yaml file that looks like:

plugin: community.general.proxmox
want_facts: no
url: https://proxmox.local:8006/
user: ansible@pve
password: secretwords_ssh
validate_certs: no

you should be able to invoke ansible-inventory like so:

ansible-inventory -i <something>.proxmox.yaml  --graph
/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py:860: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
@all:
  |--@proxmox_all_lxc:
  |  |--ansible.local
  |  |--graphite.local
  |  |--pihole.local
  |  |--znc-bouncer.local
  |--@proxmox_all_qemu:
  |  |--baileybot.local
  |  |--iphone-dumper.local
  |  |--outbound2.local
  |  |--print.local
  |  |--scarab.local
  |--@proxmox_all_running:
  |  |--baileybot.local
  |  |--iphone-dumper.local
  |  |--outbound2.local
  |  |--print.local
  |  |--scarab.local
  |--@proxmox_all_stopped:
  |--@proxmox_nodes:
  |  |--space-cruiser
  |--@proxmox_space_cruiser_lxc:
  |  |--ansible.local
  |  |--graphite.local
  |  |--pihole.local
  |  |--znc-bouncer.local
  |--@proxmox_space_cruiser_qemu:
  |  |--baileybot.local
  |  |--iphone-dumper.local
  |  |--outbound2.local
  |  |--print.local
  |  |--scarab.local
  |--@ungrouped:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment