diff --git a/playbooks/include/deploy-kvm-guest.yml b/playbooks/include/deploy-kvm-guest.yml index 02b8726..0c02ea6 100644 --- a/playbooks/include/deploy-kvm-guest.yml +++ b/playbooks/include/deploy-kvm-guest.yml @@ -62,7 +62,7 @@ tempfile: state: directory register: tmpdir - delegate_to: localhost + delegate_to: "{{ vmhost }}" when: - inventory_hostname not in result.list_vms - inject is defined @@ -77,15 +77,14 @@ echo '{{ root_pubkey }}' > /root/.ssh/authorized_keys %end dest: "{{ tmpdir.path }}/include.ks" - delegate_to: localhost + delegate_to: "{{ vmhost }}" when: - inventory_hostname not in result.list_vms - inject is defined - name: run virt-install command: > - virt-install --connect {{ vmhost_uri }} \ - --name {{ inventory_hostname }} \ + virt-install --name {{ inventory_hostname }} \ --graphics none --boot useserial=on --noautoconsole \ --serial pty,log.file={{ console_log }} \ --controller usb,model=none --sound none \ @@ -107,7 +106,7 @@ {{ virt_install_passthrough }} \ {{ virt_install_network }} \ {{ virt_install_os_args }} - delegate_to: localhost + delegate_to: "{{ vmhost }}" when: inventory_hostname not in result.list_vms - name: wait for install to finish @@ -126,7 +125,7 @@ file: path: "{{ tmpdir.path }}" state: absent - delegate_to: localhost + delegate_to: "{{ vmhost }}" when: tmpdir.path is defined - name: start vm