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
2727 stored. Default is '/var/lib/libvirt/images'.
2828
2929- ` 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 ` .
3132
3233- ` libvirt_volume_default_format ` : Format for volumes created by the role.
3334 Default is ` qcow2 ` . Options include ` raw ` , ` qcow2 ` , ` vmdk ` . See ` man virsh `
@@ -116,6 +117,7 @@ Role Variables
116117 - ` backing_image ` : (optional) name of the backing volume which is assumed to already be the same pool (copy-on-write).
117118 - ` image ` and ` backing_image ` are mutually exclusive options.
118119 - ` target ` : (optional) Manually influence type and order of volumes
120+ - ` dev ` : (optional) Block device path when type is ` block ` .
119121
120122 - ` interfaces ` : a list of network interfaces to attach to the VM.
121123 Each network interface is defined with the following dict:
@@ -219,6 +221,9 @@ Example Playbook
219221 - 'mon1.example.org'
220222 - 'mon2.example.org'
221223 - 'mon3.example.org'
224+ - type: 'block'
225+ format: 'raw'
226+ dev: '/dev/sda'
222227
223228 interfaces:
224229 - network: 'br-datacentre'
Original file line number Diff line number Diff line change 1212 src : " {{ item.image }}"
1313 dest : " {{ libvirt_vm_image_cache_path }}/{{ item.image | basename }}"
1414 checksum : " {{ item.checksum | default(omit) }}"
15+ remote_src : true
1516 with_items : " {{ volumes | selectattr('image', 'defined') | list }}"
1617 when : " 'http' not in item.image"
1718
Original file line number Diff line number Diff line change 4040 <driver name =' qemu' type =' {{ volume.format | default(libvirt_volume_default_format) }}' />
4141 {% if volume .type | default (libvirt_volume_default_type ) == 'file' %}
4242 <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' %}
4444 {% 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 >
4848 {% endif %} {# End volume.auth.username check #}
4949 {% 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 }}' >
5151 {% 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 %} />
5353 {% endfor %}
54- </source >
54+ </source >
5555 {% endif %} {# End volume.source.name check #}
56+ {% elif volume .type | default (libvirt_volume_default_type ) == 'block' %}
57+ <source dev =' {{ volume.dev }}' />
5658 {% else %} {# End elif volume.type is defined #}
5759 <source pool =' {{ volume.pool }}' volume =' {{ volume.name }}' />
5860 {% endif %}
You can’t perform that action at this time.
0 commit comments