From f1a31611b77ceaeb6ee4697815b8fd5ae62d4fde Mon Sep 17 00:00:00 2001 From: John Cardenas Date: Wed, 20 Jan 2021 13:45:04 -0800 Subject: [PATCH] Add Environment Passthrough to Proxmox Inventory Module (#1645) * Add env passthrough for Proxmox secrets * Improve descriptions for env passthrough. * Implement requested documentation changes * Add changelog fragment * Update changelogs/fragments/1645-proxmox-env-passthrough.yml Co-authored-by: Felix Fontein * Apply suggestions from code review Co-authored-by: Felix Fontein --- .../1645-proxmox-env-passthrough.yml | 3 +++ plugins/inventory/proxmox.py | 21 ++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/1645-proxmox-env-passthrough.yml diff --git a/changelogs/fragments/1645-proxmox-env-passthrough.yml b/changelogs/fragments/1645-proxmox-env-passthrough.yml new file mode 100644 index 0000000000..ce5083707b --- /dev/null +++ b/changelogs/fragments/1645-proxmox-env-passthrough.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - proxmox inventory plugin - add environment variable passthrough (https://github.com/ansible-collections/community.general/pull/1645). diff --git a/plugins/inventory/proxmox.py b/plugins/inventory/proxmox.py index 8d6670046d..60623cd2f6 100644 --- a/plugins/inventory/proxmox.py +++ b/plugins/inventory/proxmox.py @@ -27,17 +27,32 @@ DOCUMENTATION = ''' choices: ['community.general.proxmox'] type: str url: - description: URL to Proxmox cluster. + description: + - URL to Proxmox cluster. + - If the value is not specified in the inventory configuration, the value of environment variable C(PROXMOX_URL) will be used instead. default: 'http://localhost:8006' type: str + env: + - name: PROXMOX_URL + version_added: 2.0.0 user: - description: Proxmox authentication user. + description: + - Proxmox authentication user. + - If the value is not specified in the inventory configuration, the value of environment variable C(PROXMOX_USER) will be used instead. required: yes type: str + env: + - name: PROXMOX_USER + version_added: 2.0.0 password: - description: Proxmox authentication password. + description: + - Proxmox authentication password. + - If the value is not specified in the inventory configuration, the value of environment variable C(PROXMOX_PASSWORD) will be used instead. required: yes type: str + env: + - name: PROXMOX_PASSWORD + version_added: 2.0.0 validate_certs: description: Verify SSL certificate if using HTTPS. type: boolean