File tree Expand file tree Collapse file tree 4 files changed +31
-2
lines changed Expand file tree Collapse file tree 4 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,11 @@ Technology (VT) is enabled in order to run this role. While this provides
3434better VM performance, it may not be available in certain environments. The
3535default value is ` true ` .
3636
37+ ` libvirt_host_qemu_emulators ` : List of architectures for which to install QEMU
38+ system emulators, e.g. ` x86 ` . The default value is ` ['x86'] ` if
39+ ` libvirt_host_require_vt ` is ` false ` , otherwise the default value is an empty
40+ list.
41+
3742Dependencies
3843------------
3944
Original file line number Diff line number Diff line change @@ -22,3 +22,6 @@ libvirt_host_networks: []
2222# order to run this role. While this provides better VM performance, it may not
2323# be available in certain environments.
2424libvirt_host_require_vt : true
25+
26+ # List of architectures for which to install QEMU system emulators, e.g. x86.
27+ libvirt_host_qemu_emulators : " {{ [] if libvirt_host_require_vt | bool else ['x86'] }}"
Original file line number Diff line number Diff line change 1111 - qemu-kvm
1212 become : True
1313
14+ # NOTE: QEMU emulators are available in EPEL.
15+ - name : Ensure the EPEL repository is enabled
16+ yum :
17+ name : epel-release
18+ state : installed
19+ when : libvirt_host_qemu_emulators | length > 0
20+ become : True
21+
22+ - name : Ensure QEMU emulator packages are installed
23+ yum :
24+ name : " {{ package }}"
25+ state : installed
26+ with_items : " {{ libvirt_host_qemu_emulators }}"
27+ become : True
28+ vars :
29+ package : " qemu-system-{{ item }}"
30+
1431- name : Ensure the libvirt daemon is started and enabled
1532 service :
1633 name : libvirtd
Original file line number Diff line number Diff line change 55 failed_when : False
66 register : result
77
8+ - name : Set a fact about whether Virtualization Technology (VT) is enabled
9+ set_fact :
10+ libvirt_host_vt_enabled : " {{ result.rc == 0 }}"
11+
812- name : Notify if Virtualization Technology (VT) is disabled
913 debug :
1014 msg : >
1115 Virtualization Technology (VT) is currently disabled. Please enable VT
1216 before running this role again.
1317 when :
1418 - not libvirt_host_require_vt | bool
15- - result.rc != 0
19+ - not libvirt_host_vt_enabled
1620
1721- name : Fail if Virtualization Technology (VT) is disabled
1822 fail :
2125 before running this role again.
2226 when :
2327 - libvirt_host_require_vt | bool
24- - result.rc != 0
28+ - not libvirt_host_vt_enabled
You can’t perform that action at this time.
0 commit comments