ansible -m virt -a "name=vmname command=getxml" hypervisor
- name: Get XML virt: name: vmname command: get_xml register: xml_template - name: Save to file copy: content: "{{ xml_template.get_xml }}" dest: /path/for/save/file.xml