diff options
author | Christian Pointner <equinox@spreadspace.org> | 2021-06-30 20:07:53 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2021-06-30 20:07:53 +0200 |
commit | f8a7983a5fa4f6f1e583838ec0de82af08bbe340 (patch) | |
tree | 211c0e8f369b709546bf5013c5accb66059bfa9c /roles/installer/ubuntu/usb/tasks | |
parent | ubuntu installer: add support for software raid (WIP) (diff) |
fix some issues with ubuntu autoinstall and add preliminary ubuntu/usb installer role
Diffstat (limited to 'roles/installer/ubuntu/usb/tasks')
-rw-r--r-- | roles/installer/ubuntu/usb/tasks/main.yml | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/roles/installer/ubuntu/usb/tasks/main.yml b/roles/installer/ubuntu/usb/tasks/main.yml new file mode 100644 index 00000000..26df154d --- /dev/null +++ b/roles/installer/ubuntu/usb/tasks/main.yml @@ -0,0 +1,48 @@ +--- +- name: check if usb drive device exists + run_once: true + stat: + path: "{{ usb_install_path }}" + register: usb_install_device + +- name: fail if usb drive path is not a device + run_once: true + assert: + that: usb_install_device.stat.exists and usb_install_device.stat.isblk + msg: the path to the usb drive does not exist or is not a block device + +- block: + - name: create temporary workdir + tempfile: + prefix: "usb-install.{{ inventory_hostname }}." + state: directory + register: tmpdir + + - name: generate autoinstall files + vars: + ubuntu_autoinstall_tmpdir: "{{ tmpdir.path }}" + import_role: + name: installer/ubuntu/autoinstall + + - name: generate isolinux configuration for BIOS boot + template: + src: isolinux.cfg.j2 + dest: "{{ tmpdir.path }}/isolinux.cfg" + + - name: generate grub configuration for UEFI boot + template: + src: grub.cfg.j2 + dest: "{{ tmpdir.path }}/grub.cfg" + + - name: update iso9660 filesystem on installer usb drive + become: yes + command: xorriso -dev "stdio:{{ usb_install_path }}" -pathspecs on -boot_image any replay -update isolinux.cfg /isolinux/isolinux.cfg -update grub.cfg /boot/grub/grub.cfg -find / -disk_name autoinstall -type d -exec rm_r -- -add /autoinstall=autoinstall + args: + chdir: "{{ tmpdir.path }}" + + always: + - name: cleanup temporary workdir + when: tmpdir.path is defined + file: + path: "{{ tmpdir.path }}" + state: absent |