From 3463ee5fb888ef3f9f8266157f7e4d461c133cba Mon Sep 17 00:00:00 2001 From: Patrick Ladd Date: Fri, 25 Oct 2019 17:37:41 -0400 Subject: [PATCH 1/3] Allow cdrom device types for volumes --- README.md | 4 ++-- tasks/volumes.yml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5b3aaac..1feeccf 100644 --- a/README.md +++ b/README.md @@ -60,8 +60,8 @@ Role Variables - `pool`: Name or UUID of the storage pool from which the volume should be allocated. - `name`: Name to associate with the volume being created. - - `capacity`: volume capacity (can be suffixed with M,G,T or MB,GB,TB, etc) - - `device`: `disk` + - `device`: `disk` or `cdrom` + - `capacity`: volume capacity (can be suffixed with M,G,T or MB,GB,TB, etc) (required when type is `disk`) - `format`: options include `raw`, `qcow2`, `vmdk`. See `man virsh` for the full range. Default is `qcow2` - `image`: (optional) a URL to an image with which the volume is initalised (full copy). diff --git a/tasks/volumes.yml b/tasks/volumes.yml index 18d20c3..3be3aae 100644 --- a/tasks/volumes.yml +++ b/tasks/volumes.yml @@ -26,6 +26,7 @@ -b {{ item.backing_image }} {% endif %} with_items: "{{ volumes }}" + when: "{{ item.device == 'disk' }}" environment: "{{ libvirt_vm_script_env }}" register: volume_result changed_when: From 2fa07e3ddd95a8ff0b10bb11dae72bc06542b901 Mon Sep 17 00:00:00 2001 From: Patrick Ladd Date: Fri, 25 Oct 2019 18:13:53 -0400 Subject: [PATCH 2/3] Add cdrom to boot list --- templates/vm.xml.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/vm.xml.j2 b/templates/vm.xml.j2 index ca301e6..52a0085 100644 --- a/templates/vm.xml.j2 +++ b/templates/vm.xml.j2 @@ -10,6 +10,7 @@ hvm + From 851e2a5966d0f3606599099ac2bf770738dbe4b0 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Fri, 22 Nov 2019 17:15:55 +0000 Subject: [PATCH 3/3] Add default for volume.device --- tasks/volumes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/volumes.yml b/tasks/volumes.yml index 3be3aae..b77843f 100644 --- a/tasks/volumes.yml +++ b/tasks/volumes.yml @@ -26,7 +26,7 @@ -b {{ item.backing_image }} {% endif %} with_items: "{{ volumes }}" - when: "{{ item.device == 'disk' }}" + when: "{{ item.device | default(libvirt_volume_default_device) == 'disk' }}" environment: "{{ libvirt_vm_script_env }}" register: volume_result changed_when: