--- - name: install stuff apt: name: - xorriso - unzip - genisoimage update_cache: yes - name: create project directory file: dest: /opt/ansiblepackages/debianunattended state: directory - name: Download ISO Image get_url: url: "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-10.9.0-amd64-netinst.iso" dest: "/opt/ansiblepackages/debianunattended/debian-10.9.0-amd64-netinst.iso" - name: delete old stuff file: path: /opt/ansiblepackages/debianunattended/isofiles/ state: absent - name: extract ISO Image command: xorriso -osirrox on -indev /opt/ansiblepackages/debianunattended/debian-10.9.0-amd64-netinst.iso -extract / /opt/ansiblepackages/debianunattended/isofiles/ args: creates: /opt/ansiblepackages/debianunattended/isofiles/install.amd/initrd.gz - name: generate /opt/ansiblepackages/debianunattended/preseed.cfg template: src: preseed.cfg.j2 dest: /opt/ansiblepackages/debianunattended/preseed.cfg - name: generate /opt/ansiblepackages/debianunattended/md5sum.sh template: src: md5sum.sh.j2 mode: "0755" dest: /opt/ansiblepackages/debianunattended/md5sum.sh - name: generate /opt/ansiblepackages/debianunattended/mergepreseed.sh template: src: mergepreseed.sh.j2 mode: "0755" dest: /opt/ansiblepackages/debianunattended/mergepreseed.sh - name: set permissions file: dest: /opt/ansiblepackages/debianunattended/isofiles/install.amd/ mode: +w recurse: yes - name: Extract isofiles/install.amd/initrd.gz command: gunzip isofiles/install.amd/initrd.gz args: chdir: /opt/ansiblepackages/debianunattended/ - name: merge preseed.cfg command: /opt/ansiblepackages/debianunattended/mergepreseed.sh - name: generate /opt/ansiblepackages/debianunattended/isofiles/late_command.sh template: src: late_command.sh.j2 mode: "0755" dest: /opt/ansiblepackages/debianunattended/isofiles/late_command.sh - name: copy authorized_keys file copy: src: files/authorized_keys dest: /opt/ansiblepackages/debianunattended/isofiles/authorized_keys - name: compress isofiles/install.amd/initrd command: gzip isofiles/install.amd/initrd args: chdir: /opt/ansiblepackages/debianunattended/ - name: set permissions file: dest: /opt/ansiblepackages/debianunattended/isofiles/install.amd/ mode: -w recurse: yes - name: set permissions file: dest: /opt/ansiblepackages/debianunattended/isofiles/md5sum.txt mode: +w - name: generate md5sums command: /opt/ansiblepackages/debianunattended/md5sum.sh - name: set permissions file: dest: /opt/ansiblepackages/debianunattended/isofiles/md5sum.txt mode: -w - name: set permissions file: dest: /opt/ansiblepackages/debianunattended/isofiles/isolinux/isolinux.bin mode: +w - name: genisoimage command: genisoimage -r -J -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /opt/ansiblepackages/debianunattended/debian-10.9.0-amd64-netinst-unattended.iso /opt/ansiblepackages/debianunattended/isofiles