summaryrefslogtreecommitdiffstats
path: root/views/el7.ks.erb
blob: a291ad8db0faed652cb3de5ef39d6677cf468130 (plain)
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
install
reboot
text
url --url=http://mirror.switch.ch/ftp/mirror/centos/7/os/<%= arch %>/
lang en_US.UTF-8
keyboard sg-latin1
rootpw --iscrypted <%= rootpw %>
firewall --enabled --port=22:tcp
authconfig --enableshadow --passalgo=sha512 --disablefingerprint
services --disabled fcoe,ip6tables,iptables,iscsi,iscsid,lldpad,netfs,nfslock,rpcbind,rpcgssd,rpcidmapd,udev-post,lvm2-monitor,postfix,avahi-daemon,hal,kudzu,autofs,readahead,kdump,NetworkManager
# let's run puppet on first run
services --enabled puppet
timezone --utc <%= location %>
bootloader --location=mbr
firstboot --disable

zerombr
<% if ['kvm','xen'].include?(virt)
  disk = virt == 'xen' ? 'xvda' : 'vda'
  pvsize = 1
elsif virt == 'physical'
  disk = 'sda'
  pvsize = 20480
else
  raise "virt is not yet supported"
end %>

clearpart --initlabel --all --drives=<%= disk %>
ignoredisk --only-use=<%= disk %>
part /boot --fstype ext4 --size=512 --ondrive=<%= disk %>
part pv.01 --size=<%= pvsize %> --grow --ondrive=<%= disk %>
volgroup vg-<%= hostname=fqdn.split('.').first %> pv.01
logvol  /tmp  --vgname=vg-<%= hostname %> --size=1024      --name=tmp  --fstype=ext4
logvol  swap  --vgname=vg-<%= hostname %> --size=1024      --name=swap --fstype=swap
logvol  /     --vgname=vg-<%= hostname %> --size=1 --grow  --name=root --fstype=ext4

<% interfaces.keys.reject{|i| i =~ /:/ }.sort.each_with_index do |inf,i|
  values = interfaces[inf] %>
network --device=<%= inf %> --bootproto=static --ip=<%= values['ip'] %> --netmask=<%= values['netmask'] %> <%= "--gateway=#{values['gateway']} " unless values['gateway'].nil? %><% if i == 0 %><%= " --nameserver=#{values['nameserver']} --hostname=#{fqdn}" %><% end %>
<% end %>

repo --name=centos.7.<%= arch %>.os --baseurl=http://mirror.switch.ch/ftp/mirror/centos/7/os/<%= arch %>/
repo --name=centos.7.<%= arch %>.updates --baseurl=http://mirror.switch.ch/ftp/mirror/centos/7/updates/<%= arch %>/
repo --name=centos.7.<%= arch %>.cr --baseurl=http://mirror.switch.ch/ftp/mirror/centos/7/cr/<%= arch %>/
repo --name=centos.7.<%= arch %>.epel --baseurl=http://mirror.switch.ch/ftp/mirror/epel/7/<%= arch %>/
repo --name=centos.7.<%= arch %>.extras --baseurl=http://mirror.switch.ch/ftp/mirror/centos/7/extras/<%= arch %>/
repo --name=centos.7.<%= arch %>.glei --baseurl=http://yum.glei.ch/el7/<%= arch %>/
repo --name=centos.7.<%= arch %>.puppetlabs --baseurl=http://yum.puppetlabs.com/el/7/products/<%= arch %>/
repo --name=centos.7.<%= arch %>.puppetlabs.deps --baseurl=http://yum.puppetlabs.com/el/7/dependencies/<%= arch %>/


%packages
irqbalance
man-pages
mlocate
openssh-clients
openssh-server
tcp_wrappers
vim-enhanced
wget
which
virt-what
policycoreutils-python
selinux-policy-devel
acpid
iptables-services
tmpwatch
-bluez-utils
-firstboot-tui
-kudzu
-system-config-network-tui
-cpuspeed
-pcsc-lite
-ccid
-coolkey
-ifd-egate
-readahead
-oddjob
-NetworkManager
-NetworkManager-tui
-dhcdbd
-aspell
-Deployment_Guide-en-US
-desktop-file-utils
-htmlview
-pinfo
-redhat-menus
-dos2unix
-dosfstools
-mkbootdisk
-fbset
-pcmciautils
-system-config-securitylevel-tui
-wireless-tools
-rhpl
-wpa_supplicant

-microcode_ctl
-*-firmware
-smartmontools
-iprutils

-redhat-lsb-core
-dracut-config-rescue

puppet

# packages that are used on all systems
epel-release
yum-plugin-priorities
deltarpm
yum-cron
rkhunter
prelink
tmux
screen
shorewall
bash-completion
haveged
ekeyd-egd-linux
munin-node
mc
denyhosts
cryptsetup
gpm
chrony
%end

%post

<% if virt == 'xen' %>
echo "xenfs /proc/xen xenfs defaults 0 0" >> /etc/fstab

# Debian's wheezy pygrub still has a problem to boot
# http://www.frederickding.com/posts/2014/01/installing-fedora-20-paravirtualized-guest-xenserver-kickstart-061959/
# https://github.com/frederickding/xenserver-kickstart/blob/develop/centos-7.0/cent70-server.ks
cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.bak
cp /etc/default/grub /etc/default/grub.bak
cp --no-preserve=mode /etc/grub.d/00_header /etc/grub.d/00_header.bak
sed -i 's/GRUB_DEFAULT=saved/GRUB_DEFAULT=0/' /etc/default/grub
# disable serial console as this is done differently in xen
# and systemd would choke on the console device
sed -i 's/GRUB_TERMINAL=/#GRUB_TERMINAL=/' /etc/default/grub
sed -i 's/GRUB_CMDLINE_LINUX=/#GRUB_CMDLINE_LINUX=/' /etc/default/grub
sed -i 's/console=ttyS0,115200//' /etc/default/grub
sed -i 's/default="\\${next_entry}"/default="0"/' /etc/grub.d/00_header
cp --no-preserve=mode /etc/grub.d/10_linux /etc/grub.d/10_linux.bak
sed -i 's/${sixteenbit}//' /etc/grub.d/10_linux
grub2-mkconfig -o /boot/grub2/grub.cfg
<% end %>
cat <<-EOF >/etc/puppet/puppet.conf
[main]
    logdir=/var/log/puppet
    vardir=/var/lib/puppet
    rundir=/var/run/puppet

    ssldir=\$vardir/ssl
    stringify_facts=false

    # Where 3rd party plugins and modules are installed
    libdir = \$vardir/lib

    factpath = \$libdir/facter

[agent]
    report=true
    pluginsync = true

    # different run-interval, default= 30min
    # e.g. run puppetd every 4 hours = 14400
    # runinterval = 14400

    logdest=/var/log/puppet/puppet.log

    configtimeout=600
EOF

<% interfaces.keys.select{|i| i =~ /:/ }.each do |inf|
  values = interfaces[inf] %>
cat <<-EOF >/etc/sysconfig/network-scripts/ifcfg-<%= inf %>
DEVICE=<%= inf %>
ONBOOT=yes
BOOTPROTO=static
IPADDR=<%= values['ip'] %>
NETMASK=<%= values['netmask'] %>
EOF
<% end %>

if [ -f /etc/sysconfig/network-scripts/ifcfg-eth0 ]; then
  sed -i 's/GATEWAY0/GATEWAY/' /etc/sysconfig/network-scripts/ifcfg-eth0
fi

[ -d /var/lib/puppet/ssl/certs ] || mkdir -p /var/lib/puppet/ssl/certs
cat <<-EOF >/var/lib/puppet/ssl/certs/ca.pem
<%= File.read('/var/lib/puppet/ssl/certs/ca.pem') %>
EOF

%end