# Provisioning VMs with community.libvirt.virt\_install

**URL:** <https://forum.ansible.com/t/provisioning-vms-with-community-libvirt-virt-install/44661>\
**Category:** Get Help\
**Tags:** libvirt, ubuntu, collections\
**Created:** [October 10, 2025, 11:49am UTC](https://forum.ansible.com/t/provisioning-vms-with-community-libvirt-virt-install/44661 "2025-10-10T11:49:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![d1nuc0m](https://avatars.discourse-cdn.com/v4/letter/d/ce73a5/32.png) [@d1nuc0m](https://forum.ansible.com/u/d1nuc0m)\
**Post date:** [October 10, 2025, 11:49am UTC](https://forum.ansible.com/t/provisioning-vms-with-community-libvirt-virt-install/44661/1 "2025-10-10T11:49:36Z")

</div>

Hi all, I’m trying to provision some VMs with the `community.libvirt.virt_install` module but apparently I can’t get them working, maybe I’m misunderstanding something in the docs

## Unattended install

This is the snippet, basically copied from the docs:

```auto
  tasks:
    - name: Ubuntu install
      community.libvirt.virt_install:
        name: ubuntu-server
        memory: 2048
        vcpus: 2
        disks:
          - size: 25
        osinfo:
          name: ubuntu20.04
        location: http://archive.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/
        unattended:
          profile: jeos
          admin_password_file: /tmp/root_password
          user_login: ansible
          user_password_file: /tmp/user_password
        networks:
          - network: default

```

Where `/tmp/user_password` and `/tmp/root_password` just contain the string `my-secret-password`.

VM is running, using CPU/RAM and answering to pings, but the console (through shell or cockpit) just shows

```auto
Connected to domain 'ubuntu-server'
Escape character is ^] (Ctrl + ])

```

while if it’s installing I should see something (?) and the SSH port is closed

## Cloud image

I also tried to provision a VM from a cloud image with cloud-init and got errors:

I downloaded and converted to qcow2 a Kali Linux image using qemu img, as `/tmp/base-kali.qcow2` then created a qcow2 img referencing it `qemu-img create -b /tmp/base-kali.qcow2 -f qcow2 -F qcow2 /tmp/overlay-kali.qcow2 10G`

```auto
  tasks:
    - name: Create Kali VM from cloud image
      community.libvirt.virt_install:
        name: kali
        state: present
        memory: 2048
        vcpus: 1
        disks:
          - path: "/tmp/overlay-kali.qcow2"
        import: true
        cloud_init:
          clouduser_ssh_key: "ssh-rsa (...)"
        networks:
          - network: default
        osinfo:
          name: debian13

```

Also tried using both disks and nothing, always the same error, Ansible fails stating it can’t found a file (and its path is redacted)

---

<div class="post-metadata">

**Author:** ![d1nuc0m](https://avatars.discourse-cdn.com/v4/letter/d/ce73a5/32.png) [@d1nuc0m](https://forum.ansible.com/u/d1nuc0m)\
**Post date:** [October 13, 2025, 12:46pm UTC](https://forum.ansible.com/t/provisioning-vms-with-community-libvirt-virt-install/44661/3 "2025-10-13T12:46:57Z")

</div>

EDIT: clouduser\_ssh\_key requires a path
