diff --git a/plugins/modules/proxmox.py b/plugins/modules/proxmox.py index 0e21ca5df38..bed081ae68a 100644 --- a/plugins/modules/proxmox.py +++ b/plugins/modules/proxmox.py @@ -144,6 +144,7 @@ state: description: - Indicate desired state of the instance + - V(template) was added in community.general 8.0.0. type: str choices: ['present', 'started', 'absent', 'stopped', 'restarted', 'template'] default: present @@ -427,7 +428,7 @@ api_host: node1 state: template -- name: Convert container to template(stop container if running) +- name: Convert container to template (stop container if running) community.general.proxmox: vmid: 100 api_user: root@pam @@ -819,8 +820,8 @@ def main(): try: vm = proxmox.get_vm(vmid) - if proxmox.convert_to_template(vm, vmid, timeout, force=module.params['force']): - module.exit_json(changed=True, msg="VM %s is converted to template" % vmid) + proxmox.convert_to_template(vm, vmid, timeout, force=module.params['force']) + module.exit_json(changed=True, msg="VM %s is converted to template" % vmid) except Exception as e: module.fail_json(msg="conversion of VM %s to template failed with exception: %s" % (vmid, e)) diff --git a/plugins/modules/proxmox_kvm.py b/plugins/modules/proxmox_kvm.py index 08f0577ad9b..3ad6c6ae07b 100644 --- a/plugins/modules/proxmox_kvm.py +++ b/plugins/modules/proxmox_kvm.py @@ -453,8 +453,9 @@ description: - Indicates desired state of the instance. - If V(current), the current state of the VM will be fetched. You can access it with C(results.status) + - V(template) was added in community.general 8.0.0. type: str - choices: ['present', 'started', 'absent', 'stopped', 'restarted', 'current'] + choices: ['present', 'started', 'absent', 'stopped', 'restarted', 'current', 'template'] default: present storage: description: @@ -1524,8 +1525,8 @@ def main(): if vm['status'] == 'stopped': module.exit_json(changed=False, vmid=vmid, msg="VM %s is already stopped" % vmid, **status) - if proxmox.stop_vm(vm, force=module.params['force'], timeout=module.params['timeout']): - module.exit_json(changed=True, vmid=vmid, msg="VM %s is shutting down" % vmid, **status) + proxmox.stop_vm(vm, force=module.params['force'], timeout=module.params['timeout']) + module.exit_json(changed=True, vmid=vmid, msg="VM %s is shutting down" % vmid, **status) except Exception as e: module.fail_json(vmid=vmid, msg="stopping of VM %s failed with exception: %s" % (vmid, e), **status)