-
Notifications
You must be signed in to change notification settings - Fork 4
/
ks_rhel6.cfg
157 lines (140 loc) · 4.61 KB
/
ks_rhel6.cfg
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# RHEL6 Base Box Kickstart for VirtualBox and Vagrant
install
cdrom
lang en_US.UTF-8
keyboard us
unsupported_hardware
text
skipx
network --device eth0 --bootproto dhcp --noipv6 --hostname rhel6-basebox
rootpw --iscrypted $6$67g.83mtNeehgu4A$I7FIf09K0tXABMtfR31LWgeWnu3OkokGfKhPLks4uvz549ek6FRq4Yr8vgWMVX64.v9p.UlKon1QdeS/E3.ld1
firewall --disabled
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone --utc America/Los_Angeles
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet noipv6"
user --name=vagrant --password=$6$7.B050XN$b47KF1wAA3nJdFZkGAJci.D1mZQKNJ5HI8roM.3aEo8c6QU8izmO4lWmeWFatmGCa6ZPazhSm9cL2yTor6S.t/ --iscrypted --shell=/bin/bash
user --name=ansible --groups=wheel --password=$6$iY05TIgp$y4RR3xch5OerJB6x4JGCDea.0YMD0RqS7sUcEMHj1cfbM/o1CErPuTmHb8yyoZRvDgsx340A/v2X.P.rJtflY0 --iscrypted --shell=/bin/bash
services --disabled iptables,ip6tables --enabled sshd
zerombr
clearpart --all
part /boot --fstype=ext4 --size=500
part pv.01 --size=1000 --grow
volgroup vg_rhel pv.01
logvol swap --name=lv_swap --vgname=vg_rhel --size=1024
logvol / --fstype=ext4 --name=lv_root --vgname=vg_rhel --size=1000 --grow
reboot
%packages
@Base
@Core
@Development Tools
@network-tools
@server-policy
-vconfig
-acpid
-rng-tools
-sos
-biosdevname
-wireless-tools
-system-config-network-tui
-dmraid
-hunspell-en
-tcsh
-abrt-cli
-scl-utils
-ntpdate
-yum-plugin-security
-microcode_ctl
-cpuspeed
-cryptsetup-luks
-systemtap-runtime
-fprintd-pam
-dosfstools
-smartmontools
-rfkill
-ntp
-time
-blktrace
-pinfo
-rdate
-words
-abrt-addon-kerneloops
-setuptool
-pm-utils
-abrt-addon-ccpp
-bridge-utils
-nano
-eject
-mtr
-irqbalance
-pcmciautils
-usbutils
-sysstat
-ledmon
-strace
-hunspell
-redhat-access-insights
-abrt-addon-python
-system-config-firewall-tui
-b43-fwcutter
-pam_passwdqc
-nc
-libreswan
%end
%post
# Disable SELINUX per https://access.redhat.com/solutions/1237153
sed -i -e 's/\(^SELINUX=\)enforcing$/\1disabled/' /etc/selinux/config
# Install EPEL Repo
wget -O /tmp/epel-release-latest-6.noarch.rpm https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
yum -y install /tmp/epel-release-latest-6.noarch.rpm
# Handle Slow DNS Queries
echo "options single-request-reopen" >> /etc/resolv.conf
# SSHD Config
sed 's/#UseDNS\ yes/UseDNS\ no/' -i /etc/ssh/sshd_config
sed 's/GSSAPIAuthentication\ yes/GSSAPIAuthentication\ no/' -i /etc/ssh/sshd_config
sed 's/#PermitRootLogin\ yes/PermitRootLogin\ no/' -i /etc/ssh/sshd_config
# Generate SSHD Server Host Key Pair
/usr/bin/ssh-keygen -q -t rsa -f /etc/ssh/ssh_host_rsa_key -C '' -N ''
chmod 600 /etc/ssh/ssh_host_rsa_key
chmod 644 /etc/ssh/ssh_host_rsa_key.pub
# Remove hardware address from network config
sed '/HWADDR/d' -i /etc/sysconfig/network-scripts/ifcfg-eth0
sed '/UUID/d' -i /etc/sysconfig/network-scripts/ifcfg-eth0
rm -f /etc/udev/rules.d/70-persistent-net.rules
# Vagrant user ssh key
mkdir /home/vagrant/.ssh
chmod 700 /home/vagrant/.ssh
wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub
chmod 600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant:vagrant /home/vagrant/.ssh
# Modify sudoers file for wheel and vagrant user
sed '/# %wheel\tALL=(ALL)\tALL/s/^#//' -i /etc/sudoers
sed '/# %wheel\tALL=(ALL)\tNOPASSWD: ALL/a vagrant\tALL=(ALL)\tNOPASSWD:ALL' -i /etc/sudoers
# Generate Ansible user's SSH Key Pair
mkdir /home/ansible/.ssh
chmod 700 /home/ansible/.ssh
ssh-keygen -q -t rsa -C "ansible" -f /home/ansible/.ssh/id_rsa -N ""
cat /home/ansible/.ssh/id_rsa.pub > /home/ansible/.ssh/authorized_keys
chmod 600 /home/ansible/.ssh/authorized_keys
chown -R ansible:ansible /home/ansible/.ssh
# Ansible user's known_host file entries
echo "node1,192.168.60.22 `cat /etc/ssh/ssh_host_rsa_key.pub`" >> /home/ansible/.ssh/known_hosts
echo "node2,192.168.60.23 `cat /etc/ssh/ssh_host_rsa_key.pub`" >> /home/ansible/.ssh/known_hosts
echo "node3,192.168.60.24 `cat /etc/ssh/ssh_host_rsa_key.pub`" >> /home/ansible/.ssh/known_hosts
chown ansible:ansible /home/ansible/.ssh/known_hosts
# Entries in /etc/hosts
echo "192.168.60.10 ansible" >> /etc/hosts
echo "192.168.60.22 node1" >> /etc/hosts
echo "192.168.60.23 node2" >> /etc/hosts
echo "192.168.60.24 node3" >> /etc/hosts
# Install VBox Guest Additions
# Reference https://github.com/osuosl/packer-templates/blob/master/scripts/vbox-additions.sh
VBOX_VERSION=5.1.18
VBOX_URL=http://download.virtualbox.org/virtualbox/${VBOX_VERSION}/VBoxGuestAdditions_${VBOX_VERSION}.iso
VBOX_ISO=/tmp/VBoxGuestAdditions_${VBOX_VERSION}.iso
wget -q -O ${VBOX_ISO} ${VBOX_URL}
mount -o loop ${VBOX_ISO} /mnt
sh /mnt/VBoxLinuxAdditions.run
umount /mnt
rm -f ${VBOX_ISO}
%end