--- - name: download installer run_once: true vars: ubuntu_installer_codename: "{{ install_codename }}" ubuntu_installer_arch: "{{ install.arch | default('amd64') }}" ubuntu_installer_variant: "{{ ubuntu_installer_iso_variant }}" import_role: role: installer/ubuntu/fetch - block: - name: create temporary workdir tempfile: prefix: "iso-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: create destination directory file: path: "{{ iso_install_target_dir }}" state: directory - name: make sure target image does not exist file: path: "{{ iso_install_target_dir }}/{{ inventory_hostname }}.iso" state: absent - name: generate target iso image command: xorriso -indev "{{ ubuntu_installer_target_dir }}/{{ ubuntu_installer_filename }}" -outdev "{{ iso_install_target_dir }}/{{ inventory_hostname }}.iso" -pathspecs on -boot_image any replay -update isolinux.cfg /isolinux/isolinux.cfg -update grub.cfg /boot/grub/grub.cfg -add /autoinstall=autoinstall args: chdir: "{{ tmpdir.path }}" always: - name: cleanup temporary workdir when: tmpdir.path is defined file: path: "{{ tmpdir.path }}" state: absent