summaryrefslogtreecommitdiff
path: root/roles/create-pxe-archive
diff options
context:
space:
mode:
authorzsdc <taras@vyos.io>2020-02-24 23:42:19 +0200
committerzsdc <taras@vyos.io>2020-02-26 18:23:14 +0200
commit9fca551d381b1000d47d370dd3618172a1617fb4 (patch)
treed79001670319486f97ee76e3fce7e52c225164c6 /roles/create-pxe-archive
parent332dbe851c44543b69e516439baf203c9bebcadc (diff)
downloadvyos-vm-images-9fca551d381b1000d47d370dd3618172a1617fb4.tar.gz
vyos-vm-images-9fca551d381b1000d47d370dd3618172a1617fb4.zip
Fixes and additions in QEMU image building
* Fixed deleting APT lists from a cache to decrease resulting image size * Added option for creating an archive with files required for boot via PXE * Added option for keeping default user when creating an image with Cloud-init
Diffstat (limited to 'roles/create-pxe-archive')
-rw-r--r--roles/create-pxe-archive/tasks/main.yml38
1 files changed, 38 insertions, 0 deletions
diff --git a/roles/create-pxe-archive/tasks/main.yml b/roles/create-pxe-archive/tasks/main.yml
new file mode 100644
index 0000000..11dc454
--- /dev/null
+++ b/roles/create-pxe-archive/tasks/main.yml
@@ -0,0 +1,38 @@
+# Create an archive with files, required for PXE
+- name: Create directory for PXE files
+ become: true
+ file:
+ path: "/tmp/vyos-pxe-{{ vyos_version }}{{ ci_tag | default() }}"
+ state: directory
+ when:
+ - pxe is defined
+ - pxe == "true"
+
+- name: Save files required for PXE boot
+ become: true
+ copy:
+ src: "{{ vyos_write_root }}/boot/{{ vyos_version }}/{{ item }}"
+ dest: "/tmp/vyos-pxe-{{ vyos_version }}{{ ci_tag | default() }}/{{ item }}"
+ with_items:
+ - initrd.img
+ - vmlinuz
+ when:
+ - pxe is defined
+ - pxe == "true"
+
+- name: Create new squashfs image
+ become: true
+ command: "mksquashfs {{ vyos_install_root }} /tmp/vyos-pxe-{{ vyos_version }}{{ ci_tag | default() }}/filesystem.squashfs -comp gzip -no-progress -Xcompression-level 9 -e {{ vyos_install_root }}/boot -e {{ vyos_install_root }}/usr/lib/python3/dist-packages/cloudinit/config/cc_vyos.py"
+ when:
+ - pxe is defined
+ - pxe == "true"
+
+- name: Create an archive with files for PXE
+ become: true
+ archive:
+ path: "/tmp/vyos-pxe-{{ vyos_version }}{{ ci_tag | default() }}"
+ format: gz
+ dest: "/tmp/vyos-pxe-{{ vyos_version }}{{ ci_tag | default() }}.tgz"
+ when:
+ - pxe is defined
+ - pxe == "true"