From c09f529f025aedbf809e6b309604fe194989fb0c Mon Sep 17 00:00:00 2001 From: IronTooch <27360514+IronTooch@users.noreply.github.com> Date: Sat, 5 Feb 2022 15:16:07 -0500 Subject: [PATCH] Update Proxmox Inventory Documentation with additional examples (#4148) * Update Documentation with additional example * Added an example to have the plugin return an IP address for a Proxmox guest, instead of the name of the guest (default behavior) * Added an example to include a string literal to every guest (to support a playbook being able to check for variable presence to identify inventory in use) * Update for line length readability Co-authored-by: Felix Fontein * Changed to cleaner static value * Changed text for clarity Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein --- plugins/inventory/proxmox.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plugins/inventory/proxmox.py b/plugins/inventory/proxmox.py index 9d324975b3..f18a058382 100644 --- a/plugins/inventory/proxmox.py +++ b/plugins/inventory/proxmox.py @@ -114,6 +114,22 @@ groups: mailservers: "'mail' in (proxmox_tags_parsed|list)" compose: ansible_port: 2222 + +# Using the inventory to allow ansible to connect via the first IP address of the VM / Container +# (Default is connection by name of QEMU/LXC guests) +# Note: my_inv_var demonstrates how to add a string variable to every host used by the inventory. +# my.proxmox.yml +plugin: community.general.proxmox +url: http://pve.domain.com:8006 +user: ansible@pve +password: secure +validate_certs: false +want_facts: true +compose: + ansible_host: proxmox_ipconfig0.ip | default(proxmox_net0.ip) | ipaddr('address') + my_inv_var_1: "'my_var1_value'" + my_inv_var_2: > + "my_var_2_value" ''' import re