--- - hosts: lx-builder-host remote_user: root vars_files: [ vars.yml ] pre_tasks: - name: destroy current kvm vmadm: alias: "{{ kvm_alias }}" state: absent tasks: - name: create kvm vmadm: alias: "{{ kvm_alias }}" autoboot: false brand: kvm disks: - boot: true model: virtio size: 8192 nics: - nic_tag: admin ip: dhcp primary: true model: virtio ram: 4096 state: stopped vcpus: 2 register: kvm - debug: var=kvm - name: copy install iso to zone copy: remote_src: true src: "{{ kvm_install_iso }}" dest: "/zones/{{ kvm.uuid }}/root/install.iso" - name: boot from iso shell: "vmadm boot {{ kvm.uuid }} order=cd,once=d cdrom=/install.iso,ide" - name: get vnc infos shell: "vmadm info {{ kvm.uuid }} | json vnc.port" register: kvm_vnc_port - debug: var=kvm_info.stdout - debug: msg: "vncviewer {{ ansible_hostname }}:{{ kvm_vnc_port.stdout }}"