Compare commits

..

No commits in common. "v4.0.1" and "v4.0.0" have entirely different histories.

2 changed files with 9 additions and 28 deletions

View File

@ -28,33 +28,24 @@ options:
- Specify the target host of the Proxmox VE cluster.
type: str
required: true
env:
- name: PROXMOX_SERVER
api_user:
description:
- Specify the user to authenticate with.
type: str
required: true
env:
- name: PROXMOX_USER
api_password:
description:
- Specify the password to authenticate with.
- You can use C(PROXMOX_PASSWORD) environment variable.
type: str
env:
- name: PROXMOX_PASSWORD
api_token_id:
description:
- Specify the token ID.
type: str
env:
- name: PROXMOX_TOKEN_ID
api_token_secret:
description:
- Specify the token secret.
type: str
env:
- name: PROXMOX_TOKEN_SECRET
verify_ssl:
description:
- If C(false), SSL certificates will not be validated.
@ -129,7 +120,7 @@ class InventoryModule(BaseInventoryPlugin):
NAME = "xoxys.general.proxmox"
def _proxmox_auth(self):
def _auth(self):
auth_args = {"user": self.get_option("api_user")}
if not (self.get_option("api_token_id") and self.get_option("api_token_secret")):
auth_args["password"] = self.get_option("api_password")
@ -141,7 +132,7 @@ class InventoryModule(BaseInventoryPlugin):
if not verify_ssl and HAS_URLLIB3:
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
self.client = ProxmoxAPI(
return ProxmoxAPI(
self.get_option("api_host"),
verify_ssl=verify_ssl,
timeout=self.get_option("auth_timeout"),
@ -316,5 +307,5 @@ class InventoryModule(BaseInventoryPlugin):
super().parse(inventory, loader, path)
self._read_config_data(path)
self._proxmox_auth()
self.client = self._auth()
self._propagate()

View File

@ -36,13 +36,11 @@ options:
api_host:
description:
- Specify the target host of the Proxmox VE cluster.
- You can use C(PROXMOX_SERVER) environment variable.
type: str
required: true
api_user:
description:
- Specify the user to authenticate with.
- You can use C(PROXMOX_USER) environment variable.
type: str
required: true
api_password:
@ -53,13 +51,11 @@ options:
api_token_id:
description:
- Specify the token ID.
- You can use C(PROXMOX_TOKEN_ID) environment variable.
type: str
version_added: 1.3.0
api_token_secret:
description:
- Specify the token secret.
- You can use C(PROXMOX_TOKEN_SECRET) environment variable.
type: str
version_added: 1.3.0
verify_ssl:
@ -1080,17 +1076,11 @@ def main():
acpi=dict(type="bool"),
agent=dict(type="bool"),
args=dict(type="str"),
api_host=dict(required=True, type="str", fallback=(env_fallback, ["PROXMOX_SERVER"])),
api_user=dict(required=True, type="str", fallback=(env_fallback, ["PROXMOX_USER"])),
api_password=dict(
no_log=True, type="str", fallback=(env_fallback, ["PROXMOX_PASSWORD"])
),
api_token_id=dict(
no_log=True, type="str", fallback=(env_fallback, ["PROXMOX_TOKEN_ID"])
),
api_token_secret=dict(
no_log=True, type="str", fallback=(env_fallback, ["PROXMOX_TOKEN_SECRET"])
),
api_host=dict(required=True, type="str"),
api_password=dict(no_log=True, fallback=(env_fallback, ["PROXMOX_PASSWORD"])),
api_token_id=dict(no_log=True),
api_token_secret=dict(no_log=True),
api_user=dict(required=True),
autostart=dict(type="bool"),
balloon=dict(type="int"),
bios=dict(choices=["seabios", "ovmf"]),