File tree 9 files changed +71
-18
lines changed
9 files changed +71
-18
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,12 @@ the virt_ ansible modules.
85
85
bindings should be installed. If ` false ` , the python 2 bindings will be
86
86
installed.
87
87
88
+ ` libvirt_host_install_daemon ` : Whether to install and enable the libvirt
89
+ daemon. Default is ` true ` .
90
+
91
+ ` libvirt_host_install_client ` : Whether to install and enable the libvirt
92
+ client. Default is ` true ` .
93
+
88
94
Dependencies
89
95
------------
90
96
Original file line number Diff line number Diff line change @@ -67,3 +67,9 @@ libvirt_host_uri: >-
67
67
# Whether the python3 version of the libvirt python bindings should be
68
68
# installed. If false, the python 2 bindings will be installed.
69
69
libvirt_host_python3 : " {{ ansible_python.version.major == 3 }}"
70
+
71
+ # Whether to install and enable the libvirt daemon.
72
+ libvirt_host_install_daemon : true
73
+
74
+ # Whether to install and enable the libvirt client.
75
+ libvirt_host_install_client : true
Original file line number Diff line number Diff line change
1
+ ---
2
+ - name : Ensure libvirt client packages are installed
3
+ package :
4
+ name : " {{ libvirt_host_libvirt_packages_client }}"
5
+ state : present
6
+ register : result
7
+ until : result is success
8
+ retries : 3
9
+ become : True
File renamed without changes.
Original file line number Diff line number Diff line change 1
1
---
2
2
- include : prelude.yml
3
3
- include : validate.yml
4
- - include : install.yml
4
+ - include : install-daemon.yml
5
+ when : libvirt_host_install_daemon | bool
6
+ - include : install-client.yml
7
+ when :
8
+ - not libvirt_host_install_daemon | bool
9
+ - libvirt_host_install_client | bool
5
10
- name : Run post-install stage
6
11
include : " {{ post_install_path }}"
7
12
with_first_found :
12
17
loop_control :
13
18
loop_var : post_install_path
14
19
- include : config.yml
20
+ when : libvirt_host_install_daemon | bool
15
21
- include : pools.yml
16
22
- include : networks.yml
Original file line number Diff line number Diff line change 1
1
---
2
- - name : Ensure libvirt dir storage pool directories exist
3
- file :
4
- path : " {{ item.path }}"
5
- owner : " {{ item.owner }}"
6
- group : " {{ item.group }}"
7
- mode : " {{ item.mode|int(base=8) }}"
8
- state : directory
9
- when : item.type == "dir"
10
- loop : " {{ libvirt_host_pools | flatten(levels=1) }}"
11
- become : True
12
-
13
2
- name : Ensure libvirt LVM storage pool directories exist
14
3
lvg :
15
4
vg : " {{ item.source }}"
34
23
loop : " {{ libvirt_host_pools | flatten(levels=1) }}"
35
24
become : True
36
25
26
+ - name : Check libvirt directory storage pool status
27
+ virt_pool :
28
+ name : " {{ item.name }}"
29
+ command : status
30
+ uri : " {{ libvirt_host_uri | default(omit, true) }}"
31
+ when : item.type == "dir"
32
+ loop : " {{ libvirt_host_pools | flatten(levels=1) }}"
33
+ become : True
34
+ register : pool_status
35
+
36
+ - name : Ensure libvirt directory storage pools are built
37
+ virt_pool :
38
+ name : " {{ item.item.name }}"
39
+ command : build
40
+ uri : " {{ libvirt_host_uri | default(omit, true) }}"
41
+ when :
42
+ - item is not skipped
43
+ - item.status != "active"
44
+ loop : " {{ pool_status.results }}"
45
+ become : True
46
+
37
47
- name : Ensure libvirt storage pools are active
38
48
virt_pool :
39
49
name : " {{ item.name }}"
Original file line number Diff line number Diff line change 3
3
libvirt_host_libvirt_packages_default :
4
4
- libvirt
5
5
- qemu-headless
6
- - libvirt-python
7
- - python-lxml
8
6
- ebtables
9
7
- dnsmasq
10
8
9
+ # List of all client packages to install.
10
+ libvirt_host_libvirt_packages_client :
11
+ - libvirt
12
+ - libvirt-python
13
+ - python-lxml
14
+
11
15
# Packages that are only necessary if you require EFI support
12
16
libvirt_host_packages_efi :
13
17
- ovmf
14
18
15
19
# List of all packages to install
16
20
libvirt_host_libvirt_packages : >
17
21
{{ libvirt_host_libvirt_packages_default +
22
+ libvirt_host_libvirt_packages_client +
18
23
(libvirt_host_packages_efi if libvirt_host_enable_efi_support else []) | unique
19
24
}}
20
25
Original file line number Diff line number Diff line change 2
2
# List of package dependencies common to all Debian distributions
3
3
libvirt_host_libvirt_packages_common :
4
4
- qemu-kvm
5
- - " {{ 'python3-libvirt' if libvirt_host_python3 | bool else 'python-libvirt' }}"
6
- - " {{ 'python3-lxml' if libvirt_host_python3 | bool else 'python-lxml' }}"
7
5
8
6
# Package that contains the libvirt daemon
9
7
libvirt_host_libvirt_packages_libvirt_daemon : >-
@@ -16,13 +14,21 @@ libvirt_host_libvirt_packages_libvirt_daemon: >-
16
14
libvirt-daemon-system
17
15
{%- endif -%}
18
16
17
+ # List of all client packages to install.
18
+ libvirt_host_libvirt_packages_client :
19
+ - libvirt-clients
20
+ - " {{ 'python3-libvirt' if libvirt_host_python3 | bool else 'python-libvirt' }}"
21
+ - " {{ 'python3-lxml' if libvirt_host_python3 | bool else 'python-lxml' }}"
22
+
19
23
# Packages that are only necessary if you require EFI support
20
24
libvirt_host_packages_efi :
21
25
- ovmf
22
26
23
27
# List of all packages to install
24
28
libvirt_host_libvirt_packages : >
25
- {{ libvirt_host_libvirt_packages_common + [libvirt_host_libvirt_packages_libvirt_daemon] +
29
+ {{ libvirt_host_libvirt_packages_common +
30
+ [libvirt_host_libvirt_packages_libvirt_daemon] +
31
+ libvirt_host_libvirt_packages_client +
26
32
(libvirt_host_packages_efi if libvirt_host_enable_efi_support else []) | unique
27
33
}}
28
34
Original file line number Diff line number Diff line change @@ -8,9 +8,13 @@ libvirt_host_libvirt_packages_default:
8
8
- libgcrypt-devel
9
9
- libvirt
10
10
- libvirt-daemon-kvm
11
+ - qemu-kvm
12
+
13
+ # List of all client packages to install.
14
+ libvirt_host_libvirt_packages_client :
15
+ - libvirt-client
11
16
- " {{ 'python3-libvirt' if libvirt_host_python3 | bool else 'libvirt-python' }}"
12
17
- " {{ 'python3-lxml' if libvirt_host_python3 | bool else 'python-lxml' }}"
13
- - qemu-kvm
14
18
15
19
# Packages that are only necessary if you require EFI support
16
20
libvirt_host_packages_efi :
@@ -20,6 +24,7 @@ libvirt_host_packages_efi:
20
24
# List of all packages to install
21
25
libvirt_host_libvirt_packages : >
22
26
{{ libvirt_host_libvirt_packages_default +
27
+ libvirt_host_libvirt_packages_client +
23
28
(libvirt_host_packages_efi if libvirt_host_enable_efi_support else []) | unique
24
29
}}
25
30
You can’t perform that action at this time.
0 commit comments