-
Notifications
You must be signed in to change notification settings - Fork 4
/
preseed.cfg.j2
94 lines (84 loc) · 3.99 KB
/
preseed.cfg.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#########Debian Preseed
# Setting the locales, country
# Supported locales available in /usr/share/i18n/SUPPORTED
d-i debian-installer/language string en_US
d-i debian-installer/country string US
d-i debian-installer/locale string en_US.UTF-8
# Keyboard setting
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string us
d-i keyboard-configuration/xkb-keymap us
d-i keyboard-configuration/modelcode string pc105
## Account Setup
# Default user '{{ env("ssh_username") }}'
d-i passwd/root-login boolean true
d-i passwd/user-fullname string {{ env("ssh_username") }}
d-i passwd/username string {{ env("ssh_username") }}
d-i user-setup/encrypt-home boolean false
d-i passwd/root-password password {{ env("ssh_password") }}
d-i passwd/root-password-again password {{ env("ssh_password") }}
d-i passwd/user-password password {{ env("ssh_password") }}
d-i passwd/user-password-again password {{ env("ssh_password") }}
## Partitioning
# This creates an unencrypted primary ext4 partition without swap.
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string regular
d-i partman-auto/choose_recipe select unencrypted-install
d-i partman-basicfilesystems/no_swap boolean false
d-i partman-auto/expert_recipe string \
root :: \
60000 60000 60000 ext4 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
.\
10000 10000 10000 ext4 \
$primary{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 }\
mountpoint{ /boot } \
.\
10000 10000 10000 ext4 \
$primary{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 }\
mountpoint{ /home } \
.\
5000 5000 -1 ext4 \
$primary{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 }\
mountpoint{ /tmp } \
.
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
## Package Installation
tasksel tasksel/first multiselect standard, server
# Full upgrade packages after debootstrap and unattended upgrades
d-i pkgsel/upgrade select full-upgrade
d-i pkgsel/update-policy select unattended-upgrades
# Individual additional packages to install
d-i pkgsel/include string open-vm-tools openssh-server
# Do not report back on what software is installed, and what software is used
popularity-contest popularity-contest/participate boolean false
## Boot loader installation
d-i grub-installer/only_debian boolean true
d-i grub-installer/bootdev string /dev/sda
## d-i preseed/late_command string \
# echo 'user ALL=(ALL) NOPASSWD: ALL' > /target/etc/sudoers.d/user ; \
# in-target chmod 440 /etc/sudoers.d/user ; #}
### Run custom commands during the installation
# Enable passwordless sudo for default user and permit root login for Packer Ansible provisioner to work
# Set dhcp identifier to mac so each clone of template can acquire a new IP
d-i preseed/late_command string \
echo '{{ env("ssh_username") }} ALL=(ALL:ALL) NOPASSWD: ALL' >> /target/etc/sudoers.d/default-user; \
chmod 440 /target/etc/sudoers.d/default-user; \
sed -i "/^#PermitRootLogin/c\PermitRootLogin yes" /target/etc/ssh/sshd_config; \
sed -i 's/^#*\(send dhcp-client-identifier\).*$/\1 = hardware;/' /target/etc/dhcp/dhclient.conf; \
sed -i "s/dhcp4: yes/&\n dhcp-identifier: mac/" /target/etc/netplan/01-netcfg.yaml
### Finishing up the installation
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note