forked from astrostl/vagrant-centos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
centos.ks.template
80 lines (68 loc) · 2.39 KB
/
centos.ks.template
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
install
text
url --url=${CENTOS_REPOSITORY}
${ENABLE_IUS_REPOSITORY}
${ENABLE_EPEL_REPOSITORY}
lang ${LOCALE}
keyboard ${KEYBOARD}
network --onboot yes --device eth0 --bootproto dhcp --noipv6 --hostname vagrant-centos-6.vagrantup.com
rootpw vagrant
firewall --disabled
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone --utc ${TIMEZONE}
zerombr
clearpart --all
part /boot --fstype=ext4 --size=512
part pv.01 --grow --size=1
volgroup vg_vagrantcentos --pesize=4096 pv.01
logvol swap --name=lv_swap --vgname=vg_vagrantcentos --size=1024
logvol / --fstype=ext4 --name=lv_root --vgname=vg_vagrantcentos --grow --size=1
bootloader --location=mbr --append="crashkernel=auto rhgb quiet"
user --name=vagrant --groups=wheel --password=vagrant
poweroff --eject
%packages --nobase
${PACKAGES}
%end
%post --nochroot
cp /etc/resolv.conf /mnt/sysimage/etc/resolv.conf
%end
%post --log=/root/post-install.log
# Get updates except kernel. Updating kernel will break virtualbox modules and these will not recompile properly without
# booting into new kernel.
/usr/bin/yum -y update --exclude=kernel\*
# allow ssh remote commands for wheel
/bin/cat << EOF > /etc/sudoers.d/wheel
Defaults:%wheel env_keep += "SSH_AUTH_SOCK"
Defaults:%wheel !requiretty
%wheel ALL=NOPASSWD: ALL
EOF
/bin/chmod 0440 /etc/sudoers.d/wheel
# allow ssh remote commands for root
/bin/cat << EOF > /etc/sudoers.d/root
Defaults:%root env_keep += "SSH_AUTH_SOCK"
Defaults:%root !requiretty
EOF
/bin/chmod 0440 /etc/sudoers.d/root
/bin/mkdir /mnt/vbox
/bin/mount -t iso9660 /dev/sr1 /mnt/vbox
/mnt/vbox/VBoxLinuxAdditions.run
/bin/umount /mnt/vbox
/bin/rmdir /mnt/vbox
/bin/mkdir /home/vagrant/.ssh
/bin/chmod 700 /home/vagrant/.ssh
/usr/bin/wget --no-check-certificate -O /home/vagrant/.ssh/id_rsa https://raw.github.com/mitchellh/vagrant/master/keys/vagrant
/usr/bin/wget --no-check-certificate -O /home/vagrant/.ssh/authorized_keys https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub
/bin/chown -R vagrant:vagrant /home/vagrant/.ssh
/bin/chmod 0600 /home/vagrant/.ssh/*
/sbin/restorecon -Rv /home/vagrant/.ssh
/bin/echo 'UseDNS no' >> /etc/ssh/sshd_config
/bin/echo '127.0.0.1 vagrant-centos-6.vagrantup.com' >> /etc/hosts
/usr/bin/yum -y clean all
/sbin/swapoff -a
/sbin/mkswap /dev/mapper/vg_vagrantcentos-lv_swap
/bin/dd if=/dev/zero of=/boot/EMPTY bs=1M
/bin/rm -f /boot/EMPTY
/bin/dd if=/dev/zero of=/EMPTY bs=1M
/bin/rm -f /EMPTY
%end