Fix the previous commit.

Removed the previously added variable and replaced it with
create_vm_proxmox_vm_disks, which feels much nicer to use.  However some
more work is required here as the module used by the task "Manage
virtual disk for virtual machine", proxmox_disk, doesn't appear to do
any error detection/handling.  As such, a resize can fail in Proxmox but
the task will report a successful change.
master
Ronald 2 years ago
parent 49286c0375
commit de0b50a92c

@ -47,13 +47,27 @@
vcpus: "{{ create_vm_proxmox_numb_cpus | default(omit) }}" vcpus: "{{ create_vm_proxmox_numb_cpus | default(omit) }}"
cores: "{{ create_vm_proxmox_numb_cores | default(omit) }}" cores: "{{ create_vm_proxmox_numb_cores | default(omit) }}"
memory: "{{ create_vm_proxmox_memory_mb | default(omit) }}" memory: "{{ create_vm_proxmox_memory_mb | default(omit) }}"
scsi: "{{ create_vm_proxmox_scsi | default(omit) }}"
virtio: "{{ create_vm_proxmox_virtio_disks | default(omit) }}"
net: "{{ create_vm_proxmox_net | default(omit) }}" net: "{{ create_vm_proxmox_net | default(omit) }}"
when: when:
- create_vm_proxmox_check_if_vm_exists.proxmox_vms | length == 0 - create_vm_proxmox_check_if_vm_exists.proxmox_vms | length == 0
delegate_to: localhost delegate_to: localhost
- name: Manage virtual disks for virtual machine
community.general.proxmox_disk:
api_host: "{{ create_vm_proxmox_host }}"
api_user: "{{ create_vm_proxmox_user }}"
api_password: "{{ create_vm_proxmox_password }}"
vmid: "{{ create_vm_proxmox_vmid }}"
disk: "{{ item.key }}"
format: "{{ item.value.format | default(omit) }}"
storage: "{{ item.value.storage | default(omit) }}"
size: "{{ item.value.size | default(omit) }}"
state: "{{ item.value.state | default(omit) }}"
loop: "{{ create_vm_proxmox_vm_disks | dict2items }}"
when:
- create_vm_proxmox_vm_disks is defined
delegate_to: localhost
- name: Add cloud-init drive to VM - name: Add cloud-init drive to VM
community.general.proxmox_kvm: community.general.proxmox_kvm:
api_host: "{{ create_vm_proxmox_host }}" api_host: "{{ create_vm_proxmox_host }}"

Loading…
Cancel
Save