diff --git a/CHANGELOG.md b/CHANGELOG.md index fb06918..ba50742 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ -- FEATURE - - add custom modules for cornetworks dns - - add custom module iptables_raw - - add custom module openssl_pkcs12 - - add custom module proxmox_kvm - - add custom module ucr +- BUGFIX + - fix typos + - add missing defaults for parameters +- ENHANCEMENT + - add parameter `verify_ssl` (default: true) + - add parameter `auth_timeout` (default: 5) diff --git a/plugins/inventory/proxmox.py b/plugins/inventory/proxmox.py index 237944a..9e4217c 100644 --- a/plugins/inventory/proxmox.py +++ b/plugins/inventory/proxmox.py @@ -16,42 +16,54 @@ DOCUMENTATION = """ version_added: 1.0.0 description: - Get inventory hosts from the proxmox service. - - "Uses a configuration file as an inventory source, it must end in C(.proxmox.yml) or C(.proxmox.yaml) and has a C(plugin: proxmox) entry." + - "Uses a configuration file as an inventory source, it must end in C(.proxmox.yml) or C(.proxmox.yaml) and has a C(plugin: xoxys.general.proxmox) entry." extends_documentation_fragment: - inventory_cache options: plugin: - description: The name of this plugin, it should always be set to C(proxmox) for this plugin to recognize it as it"s own. + description: The name of this plugin, it should always be set to C(xoxys.general.proxmox) for this plugin to recognize it as it's own. required: yes choices: ["xoxys.general.proxmox"] server: description: Proxmox VE server url. default: "pve.example.com" + type: string required: yes env: - name: PROXMOX_SERVER user: description: Proxmox VE authentication user. + type: string required: yes env: - name: PROXMOX_USER password: - description: Proxmox VE authentication password + description: Proxmox VE authentication password. + type: string required: yes env: - name: PROXMOX_PASSWORD + verify_ssl: + description: Skip SSL certificate verification. + type: boolean + default: yes + auth_timeout: + description: Proxmox VE authentication timeout. + type: int + default: 5 exclude_vmid: - description: VMID"s to exclude from inventory + description: VMID's to exclude from inventory. type: list default: [] elements: str exclude_state: - description: VM states to exclude from inventory + description: VM states to exclude from inventory. type: list default: [] elements: str group: - description: Group to place all hosts into + description: Group to place all hosts into. + type: string default: proxmox want_facts: description: Toggle, if C(true) the plugin will retrieve host facts from the server @@ -73,6 +85,7 @@ import socket from ansible.errors import AnsibleError from ansible.module_utils._text import to_native +from ansible.module_utils.parsing.convert_bool import boolean from ansible.module_utils.six import iteritems from ansible.plugins.inventory import BaseInventoryPlugin from collections import defaultdict @@ -93,7 +106,8 @@ class InventoryModule(BaseInventoryPlugin): self.get_option("server"), user=self.get_option("user"), password=self.get_option("password"), - verify_ssl=False + verify_ssl=boolean(self.get_option("password"), strict=False), + timeout=self.get_option("auth_timeout") ) def _get_version(self):