From a9c5560dcca18a0df93341289087a9585fbca29c Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 1 Jan 2022 17:13:26 +0100 Subject: add new openwrt-based testvm add new vm-deploy playbook and script --- roles/openwrt/image/tasks/main.yml | 5 ++--- roles/vm/guest/define/templates/libvirt-domain.xml.j2 | 4 +++- roles/vm/guest/install/tasks/main.yml | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'roles') diff --git a/roles/openwrt/image/tasks/main.yml b/roles/openwrt/image/tasks/main.yml index e019bf6f..62dcbc9d 100644 --- a/roles/openwrt/image/tasks/main.yml +++ b/roles/openwrt/image/tasks/main.yml @@ -35,10 +35,9 @@ src: "{{ openwrt_imgbuilder_dir }}/{{ openwrt_tarball_basename }}/bin/targets/{{ openwrt_arch }}/{{ openwrt_target }}/{{ openwrt_output_image_name_base }}-{{ item }}" dest: "{{ openwrt_output_dir }}" - ## TODO: make this less ugly.. - name: set output image names set_fact: - openwrt_output_images: "{{ '[\"' + openwrt_output_dir + '/' + openwrt_output_image_name_base + '-' + (openwrt_output_image_suffixes | join('\", \"' + openwrt_output_dir + '/' + openwrt_output_image_name_base + '-')) + '\"]' }}" + output_images: "{{ [(openwrt_output_dir, openwrt_output_image_name_base) | path_join | realpath] | product(openwrt_output_image_suffixes) | map('join', '-') }}" always: - name: save stdout build-log to output directory @@ -53,7 +52,7 @@ content: "{{ openwrt_build.stderr }}\n" dest: "{{ openwrt_output_dir }}/build-stderr.log" - - name: Delete the temporary build directory + - name: delete the temporary build directory when: not openwrt_keep_temporary_build_dir file: path: "{{ openwrt_imgbuilder_dir }}" diff --git a/roles/vm/guest/define/templates/libvirt-domain.xml.j2 b/roles/vm/guest/define/templates/libvirt-domain.xml.j2 index 0430229b..11b1be6e 100644 --- a/roles/vm/guest/define/templates/libvirt-domain.xml.j2 +++ b/roles/vm/guest/define/templates/libvirt-domain.xml.j2 @@ -56,7 +56,7 @@ {% endif %} {% for bus in ['virtio', 'scsi'] %} {% for device, src in (install.disks[bus] | default({})).items() %} - + {% if src.type == 'lvm' %} @@ -64,6 +64,8 @@ {% elif src.type == 'blockdev' %} +{% elif src.type == 'image' %} + {% endif %} diff --git a/roles/vm/guest/install/tasks/main.yml b/roles/vm/guest/install/tasks/main.yml index f2bd5362..d4a31929 100644 --- a/roles/vm/guest/install/tasks/main.yml +++ b/roles/vm/guest/install/tasks/main.yml @@ -10,7 +10,7 @@ size: "{{ item.value.size }}" state: present -- name: create zfs base datasets for vm +- name: create zfs-based datasets for vm loop: "{{ install.disks.virtio | default({}) | combine(install.disks.scsi | default({})) | dict2items | selectattr('value.type', 'eq', 'zfs') | map(attribute='value.backend') | map('default', 'default') | unique | list }}" delegate_to: "{{ vm_host.name }}" zfs: -- cgit v1.2.3