diff --git a/changelogs/fragments/6158-create-proxmox-vm-from-archive.yml b/changelogs/fragments/6158-create-proxmox-vm-from-archive.yml new file mode 100644 index 0000000000..2c66110792 --- /dev/null +++ b/changelogs/fragments/6158-create-proxmox-vm-from-archive.yml @@ -0,0 +1,2 @@ +minor_changes: + - "proxmox_kvm - add new ``archive`` parameter. This is needed to create a VM from an archive (backup) (https://github.com/ansible-collections/community.general/pull/6159)." diff --git a/plugins/modules/proxmox_kvm.py b/plugins/modules/proxmox_kvm.py index 852f6333b7..fe55470443 100644 --- a/plugins/modules/proxmox_kvm.py +++ b/plugins/modules/proxmox_kvm.py @@ -22,6 +22,11 @@ attributes: diff_mode: support: none options: + archive: + description: + - Specify a path to an archive to restore (instead of creating or cloning a VM). + type: str + version_added: 6.5.0 acpi: description: - Specify if ACPI should be enabled/disabled. @@ -536,6 +541,14 @@ EXAMPLES = ''' name: spynal node: sabrewulf +- name: Create a VM from archive (backup) + community.general.proxmox_kvm: + api_user: root@pam + api_password: secret + api_host: helldorado + archive: backup-storage:backup/vm/140/2023-03-08T06:41:23Z + name: spynal + - name: Create new VM with minimal options and given vmid community.general.proxmox_kvm: api_user: root@pam @@ -1053,6 +1066,7 @@ class ProxmoxKvmAnsible(ProxmoxAnsible): def main(): module_args = proxmox_auth_argument_spec() kvm_args = dict( + archive=dict(type='str'), acpi=dict(type='bool'), agent=dict(type='str'), args=dict(type='str'), @@ -1256,6 +1270,7 @@ def main(): module.fail_json(msg="node '%s' does not exist in cluster" % node) proxmox.create_vm(vmid, newid, node, name, memory, cpu, cores, sockets, update, + archive=module.params['archive'], acpi=module.params['acpi'], agent=module.params['agent'], autostart=module.params['autostart'],