1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add archive param for proxmox_kvm module (#6159)

We simply add a param to allow proxmox administrator to restore VM from
an archives. This new option will be useful to automate automatic
creation and restore of VM.

Co-authored-by: Julian Vanden Broeck <julian.vandenbroeck@dalibo.com>
This commit is contained in:
Julian 2023-03-25 08:24:28 +01:00 committed by GitHub
parent f3be0076af
commit 7059789f35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View file

@ -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)."

View file

@ -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'],