stackhpc / ansible-role-libvirt-vm

This role configures and creates VMs on a KVM hypervisor.
128 stars 67 forks source link

can't get volumes to work. #96

Closed ZacharyACoon closed 1 year ago

ZacharyACoon commented 1 year ago
    - role: libvirt_host
      libvirt_host_pools:
        - name: "default"
          type: "dir"
          path: "/var/lib/libvirt/pools/default"

    - role: libvirt_vms
      libvirt_vms:
        - state: "present"
          name: "storage1"
          vcpus: 4
          memory_mb: 24576
          volumes:
            - type: "file"
              pool: "default"
              name: "storage_root"
              capacity: "16GB"

            - name: "debian-11.6.0-amd64-netinst.iso"
              device: "cdrom"
              type: "file"
              source: "/var/lib/libvirt/images/debian-11.6.0-amd64-netinst.iso"
              format: "raw"
              target: "hda"
          interfaces:
            - type: "bridge"
              source:
                dev: "eno1"
    <disk type='dir' device='disk'>\n
      <driver name='qemu' type='qcow2' />\n
      <source pool='default' volume='storage_root'/>\n
      <target dev='vda' />\n
    </disk>\n
    <disk type='file' device='cdrom'>\n
      <driver name='qemu' type='raw' />\n
      <source file='/var/lib/libvirt/images/debian-11.6.0-amd64-netinst'/>\n
        <target dev='hda' bus='sata'/>\n
    </disk>\n

Notice

I'm not sure what to do here.

ZacharyACoon commented 1 year ago

Turns out the all of this in not idempotent. I had to delete the VM and it seems to be taking changes now.