I'm trying to define a VM using the virt module and a XML file. This task:
- name: Define VM using the XML file
virt: command=define
name={{ new_vm_name }}
xml={{ vm_images_path }}/{{ new_vm_xml }}
remote_user: root
delegate_to: "{{ hyperv }}"
fails with this error:
failed: [vm-002 -> nat] => {"failed": true}
msg: (domain_definition):1: Start tag expected, '<' not found
/var/lib/libvirt/images//vm-002-ver1.1.0-00042.xml
while this works:
- name: Define VM using the XML file
command: virsh define {{ vm_images_path }}/{{ new_vm_xml }}
remote_user: root
delegate_to: "{{ hyperv }}"
XML file is the same in both cases, any idea of why the first one fails? I do always prefer using modules than custom commands so I'd really like to make the first one work.