mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #6159/7059789f backport][stable-6] Add archive param for proxmox_kvm module (#6235)
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>
(cherry picked from commit 7059789f35
)
Co-authored-by: Julian <374571+l00ptr@users.noreply.github.com>
This commit is contained in:
parent
16a18d1456
commit
1d36db1806
2 changed files with 17 additions and 0 deletions
|
@ -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)."
|
|
@ -22,6 +22,11 @@ attributes:
|
||||||
diff_mode:
|
diff_mode:
|
||||||
support: none
|
support: none
|
||||||
options:
|
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:
|
acpi:
|
||||||
description:
|
description:
|
||||||
- Specify if ACPI should be enabled/disabled.
|
- Specify if ACPI should be enabled/disabled.
|
||||||
|
@ -536,6 +541,14 @@ EXAMPLES = '''
|
||||||
name: spynal
|
name: spynal
|
||||||
node: sabrewulf
|
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
|
- name: Create new VM with minimal options and given vmid
|
||||||
community.general.proxmox_kvm:
|
community.general.proxmox_kvm:
|
||||||
api_user: root@pam
|
api_user: root@pam
|
||||||
|
@ -1053,6 +1066,7 @@ class ProxmoxKvmAnsible(ProxmoxAnsible):
|
||||||
def main():
|
def main():
|
||||||
module_args = proxmox_auth_argument_spec()
|
module_args = proxmox_auth_argument_spec()
|
||||||
kvm_args = dict(
|
kvm_args = dict(
|
||||||
|
archive=dict(type='str'),
|
||||||
acpi=dict(type='bool'),
|
acpi=dict(type='bool'),
|
||||||
agent=dict(type='str'),
|
agent=dict(type='str'),
|
||||||
args=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)
|
module.fail_json(msg="node '%s' does not exist in cluster" % node)
|
||||||
|
|
||||||
proxmox.create_vm(vmid, newid, node, name, memory, cpu, cores, sockets, update,
|
proxmox.create_vm(vmid, newid, node, name, memory, cpu, cores, sockets, update,
|
||||||
|
archive=module.params['archive'],
|
||||||
acpi=module.params['acpi'],
|
acpi=module.params['acpi'],
|
||||||
agent=module.params['agent'],
|
agent=module.params['agent'],
|
||||||
autostart=module.params['autostart'],
|
autostart=module.params['autostart'],
|
||||||
|
|
Loading…
Reference in a new issue