blob: d9215b4051a48bd838b7a7b0a070be08237027fb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
---
- name: define vm
delegate_to: "{{ vm_host.name }}"
virt:
command: define
xml: "{{ lookup('template', 'libvirt-domain.xml.j2') }}"
- name: start new vm
when: vm_create_start | bool
delegate_to: "{{ vm_host.name }}"
block:
- name: start vm
virt:
name: "{{ inventory_hostname }}"
state: running
- name: wait for VM to start
wait_for_virt:
name: "{{ inventory_hostname }}"
states: running
timeout: 10
- name: mark vm as autostarted
delegate_to: "{{ vm_host.name }}"
virt:
name: "{{ inventory_hostname }}"
autostart: "{{ vm_create_autostart }}"
command: info ## virt module needs either command or state
|