File tree Expand file tree Collapse file tree 6 files changed +53
-6
lines changed Expand file tree Collapse file tree 6 files changed +53
-6
lines changed Original file line number Diff line number Diff line change @@ -59,12 +59,17 @@ if [[ $result -ne 0 ]]; then
59
59
exit $result
60
60
fi
61
61
62
- # Change the ownership of the volume to qemu. Without doing this libvirt cannot
63
- # access the volume.
64
- output=$( chown qemu:qemu $output 2> 1)
62
+ # Change the ownership of the volume to VOLUME_OWNER:VOLUME_GROUP if
63
+ # these environmental variables are defined. Without doing this libvirt
64
+ # cannot access the volume on RedHat based GNU/Linux distributions.
65
+ existing_owner=" $( stat --format ' %U' " $output " ) "
66
+ existing_group=" $( stat --format ' %G' " $output " ) "
67
+ new_owner=" ${VOLUME_OWNER:- $existing_owner } "
68
+ new_group=" ${VOLUME_GROUP:- $existing_group } "
69
+ output=$( chown " $new_owner " :" $new_group " $output 2> 1)
65
70
result=$?
66
71
if [[ $result -ne 0 ]]; then
67
- echo " Failed to change ownership of the volume to qemu "
72
+ echo " Failed to change ownership of the volume to $new_owner : $new_group "
68
73
echo " $output "
69
74
virsh vol-delete --pool $POOL --vol $NAME
70
75
exit $result
Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ galaxy_info:
11
11
- name : EL
12
12
versions :
13
13
- 7
14
+ - name : Ubuntu
15
+ versions :
16
+ - all
17
+ - name : Debian
18
+ versions :
19
+ - all
14
20
galaxy_tags :
15
21
- cloud
16
22
- kvm
Original file line number Diff line number Diff line change 1
1
---
2
+ - name : Gather os specific variables
3
+ include_vars : " {{ item }}"
4
+ with_first_found :
5
+ - files :
6
+ - " {{ ansible_distribution }}-{{ ansible_distribution_major_version}}.yml"
7
+ - " {{ ansible_distribution }}.yml"
8
+ - " {{ ansible_os_family }}.yml"
9
+ skip : true
10
+ tags : vars
11
+
2
12
- name : Ensure the VM console log directory exists
3
13
file :
4
14
path : " {{ console_log_path | dirname }}"
5
15
state : directory
6
- owner : qemu
7
- group : qemu
16
+ owner : " {{ libvirt_vm_log_owner }} "
17
+ group : " {{ libvirt_vm_log_owner }} "
8
18
recurse : true
9
19
mode : 0770
10
20
when : console_log_enabled | bool
Original file line number Diff line number Diff line change 1
1
---
2
+ - name : Gather os specific variables
3
+ include_vars : " {{ item }}"
4
+ with_first_found :
5
+ - files :
6
+ - " {{ ansible_distribution }}-{{ ansible_distribution_major_version}}.yml"
7
+ - " {{ ansible_distribution }}.yml"
8
+ - " {{ ansible_os_family }}.yml"
9
+ tags : vars
10
+
2
11
- name : Ensure remote images are downloaded
3
12
get_url :
4
13
url : " {{ item }}"
24
33
{{ libvirt_vm_image_cache_path }}/{{ item.image | basename }}
25
34
{% endif %}
26
35
with_items : " {{ volumes }}"
36
+ environment : " {{ libvirt_vm_volume_creation_env }}"
27
37
register : volume_result
28
38
changed_when :
29
39
- volume_result is success
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ # Who owns the serial console logs in console_log_path
4
+ libvirt_vm_log_owner : libvirt-qemu
5
+
6
+ # The environment passed to virt_volume.sh
7
+ libvirt_vm_volume_creation_env : {}
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ # Who owns the serial console logs in console_log_path
4
+ libvirt_vm_log_owner : qemu
5
+
6
+ # The environment passed to virt_volume.sh
7
+ libvirt_vm_volume_creation_env :
8
+ VOLUME_GROUP : qemu
9
+ VOLUME_OWNER : qemu
You can’t perform that action at this time.
0 commit comments