blob: 8f4aa92698cc9bb225aa6b7e163d91e08bdb5299 (
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
---
- name: preparations and sanity checks
hosts: "{{ install_hostname }}"
connection: local
gather_facts: no
tasks:
- name: check if the installee belongs to the kvmguests group
fail:
msg: "the host '{{ install_hostname }}' does not belong to the group 'kvmguests'"
when:
- "'kvmguests' not in group_names"
- name: check if the host system belongs to the kvmhosts group
fail:
msg: "the host '{{ vm_host.name }}' does not belong to the group 'kvmhosts'"
when:
- "'kvmhosts' not in hostvars[vm_host.name].group_names"
- name: check if there is only one output image
fail:
msg: "the output_images variable must only contain a single image"
when:
- (output_images | length) != 1
- name: get primary disk config
set_fact:
vm_deploy_primary_disk: "{{ (install.disks.virtio | default({}) | combine(install.disks.scsi | default({})))[(install.disks.primary | basename)] | default({'type': ''}) }}"
- name: check if primary disk is of type image
fail:
msg: "the primary disk must be pointing to a disk device of type image"
when:
- vm_deploy_primary_disk.type != 'image'
- name: deploy vm
hosts: "{{ install_hostname }}"
gather_facts: no
roles:
- role: vm/guest/deploy
post_tasks:
- name: remove host-keys from ssh known-hosts
local_action: command "{{ (inventory_dir, '../remove-known-host.sh') | path_join | realpath }}" "{{ install_hostname }}"
|