updated to debian 11.2, generate iso on localhost and store in current directory

This commit is contained in:
Alexander Gabriel 2022-01-21 23:25:22 +01:00
parent 3739c29331
commit 82b0b236a1
2 changed files with 27 additions and 6 deletions

View File

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

View File

@ -66,13 +66,13 @@ d-i netcfg/choose_interface select auto
# Any hostname and domain names assigned from dhcp take precedence over # Any hostname and domain names assigned from dhcp take precedence over
# values set here. However, setting the values still prevents the questions # values set here. However, setting the values still prevents the questions
# from being shown, even if values come from dhcp. # from being shown, even if values come from dhcp.
d-i netcfg/get_hostname string {{ debianunattended_hostname | default('debianunattended') }} d-i netcfg/get_hostname string {{ inventory_hostname }}
d-i netcfg/get_domain string unassigned-domain d-i netcfg/get_domain string unassigned-domain
# If you want to force a hostname, regardless of what either the DHCP # If you want to force a hostname, regardless of what either the DHCP
# server returns or what the reverse DNS entry for the IP is, uncomment # server returns or what the reverse DNS entry for the IP is, uncomment
# and adjust the following line. # and adjust the following line.
d-i netcfg/hostname string {{ debianunattended_hostname | default('debianunattended') }} d-i netcfg/hostname string {{ inventory_hostname }}
# Disable that annoying WEP key dialog. # Disable that annoying WEP key dialog.
d-i netcfg/wireless_wep string d-i netcfg/wireless_wep string