From e1e6f1978f64525b08da562ff48fbcbd55c96129 Mon Sep 17 00:00:00 2001 From: Ronald Date: Mon, 5 May 2025 16:07:11 +0100 Subject: [PATCH] Add task to update VM hardware --- tasks/proxmox.yml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tasks/proxmox.yml b/tasks/proxmox.yml index 29b9ab6..6f7da0f 100644 --- a/tasks/proxmox.yml +++ b/tasks/proxmox.yml @@ -19,6 +19,7 @@ name: "{{ create_vm_proxmox_name }}" state: absent force: true + timeout: 30 when: - create_vm_proxmox_check_if_vm_exists.proxmox_vms is defined - create_vm_proxmox_check_if_vm_exists.proxmox_vms | length > 0 @@ -34,6 +35,10 @@ register: create_vm_proxmox_check_if_vm_exists delegate_to: localhost +- name: Debug + ansible.builtin.debug: + msg: "{{ create_vm_proxmox_numb_cores }} - {{ create_vm_proxmox_memory_mb }}" + - name: Proxmox - Clone VM in Proxmox community.general.proxmox_kvm: api_host: "{{ create_vm_proxmox_host }}" @@ -43,14 +48,24 @@ newid: "{{ create_vm_proxmox_vmid }}" name: "{{ create_vm_proxmox_name }}" clone: "{{ create_vm_proxmox_source_vm }}" - vcpus: "{{ create_vm_proxmox_numb_cpus | default(omit) }}" - cores: "{{ create_vm_proxmox_numb_cores | default(omit) }}" - memory: "{{ create_vm_proxmox_memory_mb | default(omit) }}" net: "{{ create_vm_proxmox_net | default(omit) }}" when: create_vm_proxmox_check_if_vm_exists.proxmox_vms | length == 0 register: create_vm_proxmox_clone_vm delegate_to: localhost +- name: Proxmox - Update VM hardware + community.general.proxmox_kvm: + api_host: "{{ create_vm_proxmox_host }}" + api_user: "{{ create_vm_proxmox_user }}" + api_password: "{{ create_vm_proxmox_password }}" + vmid: "{{ create_vm_proxmox_vmid }}" + node: "{{ create_vm_proxmox_host }}" + vcpus: "{{ create_vm_proxmox_numb_cpus | default(omit) }}" + cores: "{{ create_vm_proxmox_numb_cores | default(omit) }}" + memory: "{{ create_vm_proxmox_memory_mb | default(omit) }}" + update: true + delegate_to: localhost + - name: Proxmox - Manage virtual disks for virtual machine community.general.proxmox_disk: api_host: "{{ create_vm_proxmox_host }}" @@ -74,9 +89,12 @@ node: "{{ create_vm_proxmox_host }}" vmid: "{{ create_vm_proxmox_vmid }}" name: "{{ create_vm_proxmox_name }}" + update: true + update_unsafe: true ide: ide2: "{{ create_vm_proxmox_cloudinit_storage_pool }}:cloudinit,format=raw" when: create_vm_proxmox_add_cloudinit_drive | bool + delegate_to: localhost - name: Proxmox - Add cloud-init settings community.general.proxmox_kvm: