added support to copy keys to root, proxy-support and backup-static-ip-support

This commit is contained in:
Alexander Gabriel 2021-06-11 23:27:47 +01:00
parent e2c3307830
commit 12ccd5437d
5 changed files with 33 additions and 3 deletions

View File

@ -13,5 +13,7 @@ Variables:
* debianunattended_user_crypt_password: passwordhash * debianunattended_user_crypt_password: passwordhash
* debianunattended_time_zone: EU/Berlin * debianunattended_time_zone: EU/Berlin
* debianunattended_additional_packages: git nano wget bash-completion curl socat multitail python-apt * debianunattended_additional_packages: git nano wget bash-completion curl socat multitail python-apt
* debianunattended_proxystring: http://hostname:port
* debianunattended_mirror: ftp.de.debian.org
Many Thanks to https://www.librebyte.net/en/systems-deployment/unattended-debian-installation/ Many Thanks to https://www.librebyte.net/en/systems-deployment/unattended-debian-installation/

1
files/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
authorized_keys

View File

@ -58,6 +58,17 @@
- name: merge preseed.cfg - name: merge preseed.cfg
command: /opt/ansiblepackages/debianunattended/mergepreseed.sh 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 - name: compress isofiles/install.amd/initrd
command: gzip isofiles/install.amd/initrd command: gzip isofiles/install.amd/initrd
args: args:

View File

@ -0,0 +1,4 @@
#!/bin/sh
mkdir -p /target/root/.ssh
cp /cdrom/authorized_keys /target/root/.ssh
chmod 700 /target/root/.ssh -R

View File

@ -96,9 +96,9 @@ d-i netcfg/wireless_wep string
# If you select ftp, the mirror/country string does not need to be set. # If you select ftp, the mirror/country string does not need to be set.
#d-i mirror/protocol string ftp #d-i mirror/protocol string ftp
d-i mirror/country string manual d-i mirror/country string manual
d-i mirror/http/hostname string http.us.debian.org d-i mirror/http/hostname string {{ debianunattended_mirror | default('ftp.de.debian.org') }}
d-i mirror/http/directory string /debian d-i mirror/http/directory string /debian
d-i mirror/http/proxy string d-i mirror/http/proxy string {{ debianunattended_proxystring | default('') }}
# Suite to install. # Suite to install.
#d-i mirror/suite string testing #d-i mirror/suite string testing
@ -432,7 +432,7 @@ d-i finish-install/reboot_in_progress note
# still a usable /target directory. You can chroot to /target and use it # still a usable /target directory. You can chroot to /target and use it
# directly, or use the apt-install and in-target commands to easily install # directly, or use the apt-install and in-target commands to easily install
# packages and run commands in the target system. # packages and run commands in the target system.
#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh d-i preseed/late_command string /cdrom/late_command.sh
##added ##added
d-i apt-setup/cdrom/set-first boolean false d-i apt-setup/cdrom/set-first boolean false
@ -440,3 +440,15 @@ d-i apt-setup/cdrom/set-next boolean false
d-i apt-setup/cdrom/set-failed boolean false d-i apt-setup/cdrom/set-failed boolean false
apt-cdrom-setup apt-setup/cdrom/set-next boolean false apt-cdrom-setup apt-setup/cdrom/set-next boolean false
apt-cdrom-setup apt-setup/cdrom/set-failed boolean true apt-cdrom-setup apt-setup/cdrom/set-failed boolean true
{% if debianunattended_staticip_ipaddress is defined %}
#static IPv4 address?
d-i netcfg/disable_autoconfig boolean false
d-i netcfg/dhcp_failed note
d-i netcfg/dhcp_options select Configure network manually
d-i netcfg/get_ipaddress string { debianunattended_staticip_ipaddress }
d-i netcfg/get_netmask string { debianunattended_staticip_netmask }
d-i netcfg/get_gateway string { debianunattended_staticip_gateway }
d-i netcfg/get_nameservers string { debianunattended_staticip_nameservers }
d-i netcfg/confirm_static boolean true
{% endif %}