Trying to attach a virtual disk to VM slot 0 didn't actually attach a new disk to VM.
Changing slot to 1 helps.
A guess - it might be related to cloud-init ide_cdrom at slot 0.
To Reproduce
Steps to reproduce the behavior:
(.venv-ansi215-py311) [justin_cinkelj@jcnuc try-hc3]$ cat playbooks/vm_from_virtual_disk.yml
---
- name: Attach a virtual disk to VM
hosts: localhost
connection: local
gather_facts: false
vars:
vm_name: jc-ub2004-slot0
virtual_disk_name: focal-server-cloudimg-amd64.img
# attach virtual_disk_name to vm_name to this disk type/slot.
vm_disk_type: virtio_disk
vm_disk_slot: 0
tasks:
# ------------------------------------------------------
- name: List virtual disk {{ virtual_disk_name }}
scale_computing.hypercore.virtual_disk_info:
name: "{{ virtual_disk_name }}"
register: virtual_disk_info_result
- name: Check virtual disk is present
ansible.builtin.assert:
that:
- virtual_disk_info_result.records | length == 1
# ------------------------------------------------------
- name: Create VM {{ vm_name }}
scale_computing.hypercore.vm:
vm_name: "{{ vm_name }}"
tags:
- justin
- aap24
memory: "{{ '2 GB' | human_to_bytes }}"
vcpu: 2
disks: []
nics:
- type: virtio
vlan: 0
state: present
power_state: shutdown
operating_system: os_other
cloud_init:
user_data: "{{ lookup('file', '../data/cloud-init-user-data-cloudimage.yml') }}"
register: vm_result
- name: Show the info about VM {{ vm_name }}
ansible.builtin.debug:
var: vm_result
register: vm_info_result
# ------------------------------------------------------
- name: Attach virtual disk to VM - {{ vm_name + ", " + virtual_disk_name + " " + vm_disk_type + ":" + vm_disk_slot | string }}
scale_computing.hypercore.virtual_disk_attach:
name: "{{ virtual_disk_name }}"
vm_name: "{{ vm_name }}"
disk:
type: "{{ vm_disk_type }}"
disk_slot: "{{ vm_disk_slot }}"
disable_snapshotting: false
register: attach_result
- name: Show attach action result
ansible.builtin.debug:
var: attach_result
- name: Set boot device
scale_computing.hypercore.vm_boot_devices:
vm_name: "{{ vm_name }}"
state: set
items:
- type: "{{ vm_disk_type }}"
disk_slot: "{{ vm_disk_slot }}"
shutdown_timeout: 30
- name: Start VM
scale_computing.hypercore.vm_params:
vm_name: "{{ vm_name }}"
power_state: start
(.venv-ansi215-py311) [justin_cinkelj@jcnuc try-hc3]$
ansible-playbook playbooks/vm_from_virtual_disk.yml
Expected behavior
A VD should be cloned to the VM.
Screenshots
If applicable, add screenshots to help explain your problem.
System Info (please complete the following information):
OS: [e.g. iOS]
HyperCore Version: 9.3.5, 9.4.0
Ansible Version: 3.15
Collection Version 1.3.0, also current main@79a1437c3bf270e2e4a36f45240b09718293e9de
Describe the bug
Trying to attach a virtual disk to VM slot 0 didn't actually attach a new disk to VM. Changing slot to 1 helps. A guess - it might be related to cloud-init ide_cdrom at slot 0.
To Reproduce Steps to reproduce the behavior:
Expected behavior
A VD should be cloned to the VM.
Screenshots
If applicable, add screenshots to help explain your problem.
System Info (please complete the following information):
Additional context
Add any other context about the problem here.