File tree Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,8 @@ Role Variables
27
27
stored. Default is '/var/lib/libvirt/images'.
28
28
29
29
- ` libvirt_volume_default_type ` : What type of backing volume does the instance
30
- use? Default is ` volume ` . Options include ` file ` , ` network ` and ` volume ` .
30
+ use? Default is ` volume ` . Options include ` block ` , ` file ` , ` network ` and
31
+ ` volume ` .
31
32
32
33
- ` libvirt_volume_default_format ` : Format for volumes created by the role.
33
34
Default is ` qcow2 ` . Options include ` raw ` , ` qcow2 ` , ` vmdk ` . See ` man virsh `
@@ -116,6 +117,7 @@ Role Variables
116
117
- ` backing_image ` : (optional) name of the backing volume which is assumed to already be the same pool (copy-on-write).
117
118
- ` image ` and ` backing_image ` are mutually exclusive options.
118
119
- ` target ` : (optional) Manually influence type and order of volumes
120
+ - ` dev ` : (optional) Block device path when type is ` block ` .
119
121
120
122
- ` interfaces ` : a list of network interfaces to attach to the VM.
121
123
Each network interface is defined with the following dict:
@@ -219,6 +221,9 @@ Example Playbook
219
221
- 'mon1.example.org'
220
222
- 'mon2.example.org'
221
223
- 'mon3.example.org'
224
+ - type: 'block'
225
+ format: 'raw'
226
+ dev: '/dev/sda'
222
227
223
228
interfaces:
224
229
- network: 'br-datacentre'
Original file line number Diff line number Diff line change 12
12
src : " {{ item.image }}"
13
13
dest : " {{ libvirt_vm_image_cache_path }}/{{ item.image | basename }}"
14
14
checksum : " {{ item.checksum | default(omit) }}"
15
+ remote_src : true
15
16
with_items : " {{ volumes | selectattr('image', 'defined') | list }}"
16
17
when : " 'http' not in item.image"
17
18
Original file line number Diff line number Diff line change 40
40
<driver name =' qemu' type =' {{ volume.format | default(libvirt_volume_default_format) }}' />
41
41
{% if volume .type | default (libvirt_volume_default_type ) == 'file' %}
42
42
<source file =' {{ volume.file_path |default(libvirt_volume_default_images_path) }}/{{ volume.name}}' />
43
- {% elif volume .type is defined and volume . type == 'network' %}
43
+ {% elif volume .type | default ( libvirt_volume_default_type ) == 'network' %}
44
44
{% if volume .auth .username is defined %}
45
- <auth username =' {{ volume.auth.username }}' >
46
- <secret type =' {{ volume.auth.type }}' {% if volume.auth.uuid is defined and volume.auth.uuid is not none %} uuid =' {{ volume.auth.uuid }}' {% else %} usage =' {{ volume.auth.usage }}' {% endif %} />
47
- </auth >
45
+ <auth username =' {{ volume.auth.username }}' >
46
+ <secret type =' {{ volume.auth.type }}' {% if volume.auth.uuid is defined and volume.auth.uuid is not none %} uuid =' {{ volume.auth.uuid }}' {% else %} usage =' {{ volume.auth.usage }}' {% endif %} />
47
+ </auth >
48
48
{% endif %} {# End volume.auth.username check #}
49
49
{% if volume .source .name is defined %}
50
- <source protocol =' {{ volume.source.protocol }}' name =' {{ volume.source.name }}' >
50
+ <source protocol =' {{ volume.source.protocol }}' name =' {{ volume.source.name }}' >
51
51
{% for host in volume .source .hosts_list %}
52
- <host name =' {{ host }}' {% if volume.source.port is defined and volume.source.port is not none %} port =' {{ volume.source.port }}' {% endif %} />
52
+ <host name =' {{ host }}' {% if volume.source.port is defined and volume.source.port is not none %} port =' {{ volume.source.port }}' {% endif %} />
53
53
{% endfor %}
54
- </source >
54
+ </source >
55
55
{% endif %} {# End volume.source.name check #}
56
+ {% elif volume .type | default (libvirt_volume_default_type ) == 'block' %}
57
+ <source dev =' {{ volume.dev }}' />
56
58
{% else %} {# End elif volume.type is defined #}
57
59
<source pool =' {{ volume.pool }}' volume =' {{ volume.name }}' />
58
60
{% endif %}
You can’t perform that action at this time.
0 commit comments