community.general.proxmox – Proxmox inventory source
Note
This plugin is part of the community.general collection (version 3.8.3).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.proxmox
.
New in version 1.2.0: of community.general
Synopsis
Get inventory hosts from a Proxmox PVE cluster.
Uses a configuration file as an inventory source, it must end in
.proxmox.yml
or.proxmox.yaml
Will retrieve the first network interface with an IP for Proxmox nodes.
Can retrieve LXC/QEMU configuration as facts.
Requirements
The below requirements are needed on the local controller node that executes this inventory.
requests >= 1.1
Parameters
Parameter |
Comments |
---|---|
Toggle to enable/disable the caching of the inventory’s source data, requires a cache plugin setup to work. Choices:
Configuration:
|
|
Cache connection data or path, read cache plugin documentation for specifics. Configuration:
|
|
Cache plugin to use for the inventory’s source data. Default: “memory” Configuration:
|
|
Prefix to use for cache plugin files/tables Default: “ansible_inventory_” Configuration:
|
|
Cache duration in seconds Default: 3600 Configuration:
|
|
Create vars from jinja2 expressions. Default: {} |
|
Prefix to apply to LXC/QEMU config facts. Default: “proxmox_” |
|
Prefix to apply to Proxmox groups. Default: “proxmox_” |
|
Add hosts to group based on Jinja2 conditionals. Default: {} |
|
Add hosts to group based on the values of a variable. Default: [] |
|
Use in conjunction with keyed_groups. By default, a keyed group that does not have a prefix or a separator provided will have a name that starts with an underscore. This is because the default prefix is “” and the default separator is “_”. Set this option to False to omit the leading underscore (or other separator) if no prefix is given. If the group name is derived from a mapping the separator is still used to concatenate the items. To not use a separator in the group name at all, set the separator for the keyed group to an empty string instead. Choices:
|
|
Proxmox authentication password. If the value is not specified in the inventory configuration, the value of environment variable Configuration:
|
|
The name of this plugin, it should always be set to Choices:
|
|
If Since it is possible to use facts in the expressions they might not always be available and we ignore those errors by default. Choices:
|
|
URL to Proxmox cluster. If the value is not specified in the inventory configuration, the value of environment variable Default: “http://localhost:8006” Configuration:
|
|
Merge extra vars into the available variables for composition (highest precedence). Choices:
Configuration:
|
|
Proxmox authentication user. If the value is not specified in the inventory configuration, the value of environment variable Configuration:
|
|
Verify SSL certificate if using HTTPS. Choices:
|
|
Gather LXC/QEMU configuration facts. Choices:
|
|
Whether to set When set to Choices:
|
Examples
# Minimal example which will not gather additional facts for QEMU/LXC guests
# By not specifying a URL the plugin will attempt to connect to the controller host on port 8006
# my.proxmox.yml
plugin: community.general.proxmox
user: ansible@pve
password: secure
# More complete example demonstrating the use of 'want_facts' and the constructed options
# Note that using facts returned by 'want_facts' in constructed options requires 'want_facts=true'
# my.proxmox.yml
plugin: community.general.proxmox
url: http://pve.domain.com:8006
user: ansible@pve
password: secure
validate_certs: false
want_facts: true
keyed_groups:
# proxmox_tags_parsed is an example of a fact only returned when 'want_facts=true'
- key: proxmox_tags_parsed
separator: ""
prefix: group
groups:
webservers: "'web' in (proxmox_tags_parsed|list)"
mailservers: "'mail' in (proxmox_tags_parsed|list)"
compose:
ansible_port: 2222
Authors
Jeffrey van Pelt (@Thulium-Drake) <jeff@vanpelt.one>