kickstart-builder/isos/samples/lvm/ks.default

194 lines
3.9 KiB
Plaintext
Raw Normal View History

2017-05-28 15:41:02 -07:00
#System language
lang en_US
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
#Language modules to install
langsupport en_US
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
#System keyboard
keyboard us
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
#System mouse
mouse
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
#System timezone
timezone America/Los_Angeles
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
#Root password
2017-05-28 16:38:17 -07:00
rootpw ubuntu
2017-05-28 15:41:02 -07:00
#Initial user
user --disabled
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
#Reboot after installation
reboot
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
#Use text mode install
text
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
#Install OS instead of upgrade
install
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
#Use CDROM installation media
cdrom
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
#System bootloader configuration
bootloader --location=mbr
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
#Clear the Master Boot Record
zerombr yes
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
#Partition clearing information
clearpart --all --initlabel
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
#Disk partitioning information
2017-05-28 16:38:17 -07:00
part /boot --fstype ext2 --size=500
part pv.01 --size=1 --grow
volgroup vg_root pv.01
2017-05-28 17:27:05 -07:00
logvol / --vgname=vg_root --name=lv_root --size 1 --grow
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
#System authorization infomation
auth --useshadow --enablemd5
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
#Network information
network --bootproto=dhcp --device=eth0
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
#Firewall configuration
firewall --disabled
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
#Do not configure the X Window System
skipx
%packages
openssh-server
vim
htop
2017-05-28 16:38:17 -07:00
2017-05-28 15:41:02 -07:00
%post
# Add arbitrary shell code to execute in the installer environment below here
2019-04-06 16:50:54 -07:00
# Ubuntu user
useradd --create-home --groups sudo --shell /bin/bash ubuntu
echo "ubuntu:ubuntu" | chpasswd
touch /home/ubuntu/.sudo_as_admin_successful
# First time startup script
cat <<"EOF" > /usr/local/sbin/vm-firstboot.sh
#!/bin/bash
set +x
sed -i -E "s/^#?PermitRootLogin .+/PermitRootLogin yes/" /etc/ssh/sshd_config
apt-get update
apt-get dist-upgrade -y
2019-04-07 14:46:47 -07:00
apt-get install -y open-vm-tools dirmngr
2019-04-06 16:50:54 -07:00
rm /etc/firstboot
reboot
EOF
chmod +x /usr/local/sbin/vm-firstboot.sh
# and systemd unit to call it
cat <<"EOF" > /etc/systemd/system/vm-firstboot.service
[Unit]
Description=Initialize this template-created VM
ConditionPathExists=/etc/firstboot
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/vm-firstboot.sh
[Install]
WantedBy=multi-user.target
EOF
ln -s /etc/systemd/system/vm-firstboot.service /etc/systemd/system/multi-user.target.wants/vm-firstboot.service
touch /etc/firstboot
# Template cleanup helper script
cat <<"EOF" > /usr/local/sbin/vm-clean.sh
#!/bin/bash
2017-05-28 15:41:02 -07:00
touch /etc/firstboot
2019-04-06 16:50:54 -07:00
rm -f /etc/ssh/*key*
rm -f /etc/machine-id
EOF
chmod +x /usr/local/sbin/vm-clean.sh
# First boot ssh key regen
cat <<"EOF" > /lib/systemd/system/ssh.service
[Unit]
Description=OpenBSD Secure Shell server
After=network.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
[Service]
EnvironmentFile=-/etc/default/ssh
ExecStartPre=/bin/bash -c "test -f /etc/ssh/ssh_host_rsa_key || ssh-keygen -A"
ExecStartPre=/usr/sbin/sshd -t
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/usr/sbin/sshd -t
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify
RuntimeDirectory=sshd
RuntimeDirectoryMode=0755
[Install]
WantedBy=multi-user.target
Alias=sshd.service
EOF
# First boot machine uuidgen
cat <<"EOF" > /etc/systemd/system/machineidgen.service
[Unit]
Description=Regen machine-id on first boot
Before=systemd-networkd.service systemd-journald.service
After=local-fs.target
ConditionPathExists=!/etc/machine-id
[Service]
Type=oneshot
ExecStart=/bin/systemd-machine-id-setup
[Install]
WantedBy=multi-user.target
EOF
ln -s /etc/systemd/system/machineidgen.service /etc/systemd/system/multi-user.target.wants/machineidgen.service
rm /etc/machine-id
# Show IP address on console
cp /etc/issue /etc/issue.tpl
cat <<"EOF" > /usr/local/sbin/console-set-ip.sh
#!/bin/bash
cat /etc/issue.tpl > /etc/issue
(ip addr | grep inet | awk '{print $2}' | grep -vE '^(::|fe80|127\.0\.0)') 2>&1 >> /etc/issue
echo "" >> /etc/issue
EOF
chmod +x /usr/local/sbin/console-set-ip.sh
cat <<"EOF" > /etc/systemd/system/consoleip.service
[Unit]
Description=Display machine ip on console
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/console-set-ip.sh
[Install]
WantedBy=multi-user.target
EOF
ln -s /etc/systemd/system/consoleip.service /etc/systemd/system/multi-user.target.wants/consoleip.service
rm -f /etc/update-motd.d/50-motd-news /etc/update-motd.d/80-livepatch