From 5aac81bdd1d1711009d74e6e263ddd86ae915c62 Mon Sep 17 00:00:00 2001 From: almdudler777 <43605831+almdudler777@users.noreply.github.com> Date: Mon, 15 Feb 2021 22:40:51 +0100 Subject: [PATCH] proxmox_kvm: 500 error args parameter (#1783) * don't add args if set to 'no_defaults' * never add force even if false, will require archive parameter other which is not implemented * remove trailing whitespace * add changelog fragment * Update changelogs/fragments/1783-proxmox-kvm-fix-args-500-error.yaml Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein --- .../fragments/1783-proxmox-kvm-fix-args-500-error.yaml | 3 +++ plugins/modules/cloud/misc/proxmox_kvm.py | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/1783-proxmox-kvm-fix-args-500-error.yaml diff --git a/changelogs/fragments/1783-proxmox-kvm-fix-args-500-error.yaml b/changelogs/fragments/1783-proxmox-kvm-fix-args-500-error.yaml new file mode 100644 index 0000000000..5e46b066a8 --- /dev/null +++ b/changelogs/fragments/1783-proxmox-kvm-fix-args-500-error.yaml @@ -0,0 +1,3 @@ +bugfixes: + - proxmox_kvm - do not add ``args`` if ``proxmox_default_behavior`` is set to no_defaults (https://github.com/ansible-collections/community.general/issues/1641). + - proxmox_kvm - stop implicitly adding ``force`` equal to ``false``. Proxmox API requires not implemented parameters otherwise, and assumes ``force`` to be ``false`` by default anyways (https://github.com/ansible-collections/community.general/pull/1783). diff --git a/plugins/modules/cloud/misc/proxmox_kvm.py b/plugins/modules/cloud/misc/proxmox_kvm.py index 3e4e6449da..eee698405e 100644 --- a/plugins/modules/cloud/misc/proxmox_kvm.py +++ b/plugins/modules/cloud/misc/proxmox_kvm.py @@ -31,6 +31,9 @@ options: description: - Pass arbitrary arguments to kvm. - This option is for experts only! + - If I(proxmox_default_behavior) is set to C(compatiblity) (the default value), this + option has a default of C(-serial unix:/var/run/qemu-server/.serial,server,nowait). + Note that the default value of I(proxmox_default_behavior) changes in community.general 4.0.0. type: str autostart: description: @@ -925,9 +928,9 @@ def create_vm(module, proxmox, vmid, newid, node, name, memory, cpu, cores, sock if searchdomains: kwargs['searchdomain'] = ' '.join(searchdomains) - # -args and skiplock require root@pam user + # -args and skiplock require root@pam user - but can not use api tokens if module.params['api_user'] == "root@pam" and module.params['args'] is None: - if not update: + if not update and module.params['proxmox_default_behavior'] == 'compatibility': kwargs['args'] = vm_args elif module.params['api_user'] == "root@pam" and module.params['args'] is not None: kwargs['args'] = module.params['args'] @@ -1118,7 +1121,6 @@ def main(): cores=1, cpu='kvm64', cpuunits=1000, - force=False, format='qcow2', kvm=True, memory=512,