community.general.proxmox (8.5.0) — inventory

Proxmox inventory source

| "added in version" 1.2.0 of community.general"

Authors: Jeffrey van Pelt (@Thulium-Drake) <jeff@vanpelt.one>

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Get inventory hosts from a Proxmox PVE cluster.

Uses a configuration file as an inventory source, it must end in C(.proxmox.yml) or C(.proxmox.yaml)

Will retrieve the first network interface with an IP for Proxmox nodes.

Can retrieve LXC/QEMU configuration as facts.


Requirements

Inputs

    
url:
    default: http://localhost:8006
    description:
    - URL to Proxmox cluster.
    - If the value is not specified in the inventory configuration, the value of environment
      variable E(PROXMOX_URL) will be used instead.
    - Since community.general 4.7.0 you can also use templating to specify the value of
      the O(url).
    env:
    - name: PROXMOX_URL
      version_added: 2.0.0
      version_added_collection: community.general
    type: str

user:
    description:
    - Proxmox authentication user.
    - If the value is not specified in the inventory configuration, the value of environment
      variable E(PROXMOX_USER) will be used instead.
    - Since community.general 4.7.0 you can also use templating to specify the value of
      the O(user).
    env:
    - name: PROXMOX_USER
      version_added: 2.0.0
      version_added_collection: community.general
    required: true
    type: str

cache:
    default: false
    description:
    - Toggle to enable/disable the caching of the inventory's source data, requires a
      cache plugin setup to work.
    env:
    - name: ANSIBLE_INVENTORY_CACHE
    ini:
    - key: cache
      section: inventory
    type: bool

groups:
    default: {}
    description: Add hosts to group based on Jinja2 conditionals.
    type: dict
    version_added: 2.5.0
    version_added_collection: community.general

plugin:
    choices:
    - community.general.proxmox
    description: The name of this plugin, it should always be set to V(community.general.proxmox)
      for this plugin to recognize it as it's own.
    required: true
    type: str

strict:
    default: false
    description:
    - If V(yes) make invalid entries a fatal error, otherwise skip and continue.
    - Since it is possible to use facts in the expressions they might not always be available
      and we ignore those errors by default.
    type: bool
    version_added: 2.5.0
    version_added_collection: community.general

compose:
    default: {}
    description: Create vars from jinja2 expressions.
    type: dict
    version_added: 2.5.0
    version_added_collection: community.general

filters:
    default: []
    description: A list of Jinja templates that allow filtering hosts.
    elements: str
    type: list
    version_added: 4.6.0
    version_added_collection: community.general

password:
    description:
    - Proxmox authentication password.
    - If the value is not specified in the inventory configuration, the value of environment
      variable E(PROXMOX_PASSWORD) will be used instead.
    - Since community.general 4.7.0 you can also use templating to specify the value of
      the O(password).
    - If you do not specify a password, you must set O(token_id) and O(token_secret) instead.
    env:
    - name: PROXMOX_PASSWORD
      version_added: 2.0.0
      version_added_collection: community.general
    type: str

token_id:
    description:
    - Proxmox authentication token ID.
    - If the value is not specified in the inventory configuration, the value of environment
      variable E(PROXMOX_TOKEN_ID) will be used instead.
    - To use token authentication, you must also specify O(token_secret). If you do not
      specify O(token_id) and O(token_secret), you must set a password instead.
    - Make sure to grant explicit pve permissions to the token or disable 'privilege separation'
      to use the users' privileges instead.
    env:
    - name: PROXMOX_TOKEN_ID
    type: str
    version_added: 4.8.0
    version_added_collection: community.general

want_facts:
    default: false
    description:
    - Gather LXC/QEMU configuration facts.
    - When O(want_facts) is set to V(true) more details about QEMU VM status are possible,
      besides the running and stopped states. Currently if the VM is running and it is
      suspended, the status will be running and the machine will be in C(running) group,
      but its actual state will be paused. See O(qemu_extended_statuses) for how to retrieve
      the real status.
    type: bool

cache_plugin:
    default: memory
    description:
    - Cache plugin to use for the inventory's source data.
    env:
    - name: ANSIBLE_CACHE_PLUGIN
    - name: ANSIBLE_INVENTORY_CACHE_PLUGIN
    ini:
    - key: fact_caching
      section: defaults
    - key: cache_plugin
      section: inventory
    type: str

cache_prefix:
    default: ansible_inventory_
    description:
    - Prefix to use for cache plugin files/tables
    env:
    - name: ANSIBLE_CACHE_PLUGIN_PREFIX
    - name: ANSIBLE_INVENTORY_CACHE_PLUGIN_PREFIX
    ini:
    - key: fact_caching_prefix
      section: defaults
    - key: cache_prefix
      section: inventory

facts_prefix:
    default: proxmox_
    description: Prefix to apply to LXC/QEMU config facts.
    type: str

group_prefix:
    default: proxmox_
    description: Prefix to apply to Proxmox groups.
    type: str

keyed_groups:
    default: []
    description: Add hosts to group based on the values of a variable.
    elements: dict
    suboptions:
      default_value:
        description:
        - The default value when the host variable's value is an empty string.
        - This option is mutually exclusive with O(keyed_groups[].trailing_separator).
        type: str
        version_added: '2.12'
        version_added_collection: ansible.builtin
      key:
        description:
        - The key from input dictionary used to generate groups
        type: str
      parent_group:
        description: parent group for keyed group
        type: str
      prefix:
        default: ''
        description: A keyed group name will start with this prefix
        type: str
      separator:
        default: _
        description: separator used to build the keyed group name
        type: str
      trailing_separator:
        default: true
        description:
        - Set this option to V(False) to omit the O(keyed_groups[].separator) after the
          host variable when the value is an empty string.
        - This option is mutually exclusive with O(keyed_groups[].default_value).
        type: bool
        version_added: '2.12'
        version_added_collection: ansible.builtin
    type: list
    version_added: 2.5.0
    version_added_collection: community.general

token_secret:
    description:
    - Proxmox authentication token secret.
    - If the value is not specified in the inventory configuration, the value of environment
      variable E(PROXMOX_TOKEN_SECRET) will be used instead.
    - To use token authentication, you must also specify O(token_id). If you do not specify
      O(token_id) and O(token_secret), you must set a password instead.
    env:
    - name: PROXMOX_TOKEN_SECRET
    type: str
    version_added: 4.8.0
    version_added_collection: community.general

cache_timeout:
    default: 3600
    description:
    - Cache duration in seconds
    env:
    - name: ANSIBLE_CACHE_PLUGIN_TIMEOUT
    - name: ANSIBLE_INVENTORY_CACHE_TIMEOUT
    ini:
    - key: fact_caching_timeout
      section: defaults
    - key: cache_timeout
      section: inventory
    type: int

exclude_nodes:
    default: false
    description: Exclude proxmox nodes and the nodes-group from the inventory output.
    type: bool
    version_added: 8.1.0
    version_added_collection: community.general

use_extra_vars:
    default: false
    description: Merge extra vars into the available variables for composition (highest
      precedence).
    env:
    - name: ANSIBLE_INVENTORY_USE_EXTRA_VARS
    ini:
    - key: use_extra_vars
      section: inventory_plugins
    type: bool
    version_added: '2.11'
    version_added_collection: ansible.builtin

validate_certs:
    default: true
    description: Verify SSL certificate if using HTTPS.
    type: boolean

cache_connection:
    description:
    - Cache connection data or path, read cache plugin documentation for specifics.
    env:
    - name: ANSIBLE_CACHE_PLUGIN_CONNECTION
    - name: ANSIBLE_INVENTORY_CACHE_CONNECTION
    ini:
    - key: fact_caching_connection
      section: defaults
    - key: cache_connection
      section: inventory
    type: str

leading_separator:
    default: true
    description:
    - 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.
    type: boolean
    version_added: '2.11'
    version_added_collection: ansible.builtin

qemu_extended_statuses:
    default: false
    description:
    - Requires O(want_facts) to be set to V(true) to function. This will allow you to
      differentiate between C(paused) and C(prelaunch) statuses of the QEMU VMs.
    - This introduces multiple groups [prefixed with O(group_prefix)] C(prelaunch) and
      C(paused).
    type: bool
    version_added: 5.1.0
    version_added_collection: community.general

want_proxmox_nodes_ansible_host:
    default: false
    description:
    - Whether to set C(ansible_host) for proxmox nodes.
    - When set to V(true) (default), will use the first available interface. This can
      be different from what you expect.
    - The default of this option changed from V(true) to V(false) in community.general
      6.0.0.
    type: bool
    version_added: 3.0.0
    version_added_collection: community.general