-
Notifications
You must be signed in to change notification settings - Fork 5
/
ks-isolinux.cfg
92 lines (90 loc) · 3.25 KB
/
ks-isolinux.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
#version=RHEL7
# install a fresh system
install
# Use CDROM installation media
cdrom
# Perform a text-based install
text
# System language
lang en_US.UTF-8
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# Root password
rootpw --iscrypted $6$8z2.xKRx6YdOvRDP$BwfVHPhTed9HtUA3oBJM.Y0tVppkzZLloOj5TkKojWgKsG4BJJaiM/bbQioqxUbuIaSKTMQ4aOvJG2FB9oVBS.
# Network information
network --hostname=localhost.localdomain
# System authorization information
auth --enableshadow --passalgo=sha512
# System timezone
timezone America/New_York --isUtc
# System bootloader configuration
bootloader --location=mbr --driveorder=sda --append=crashkernel=auto rhgb quiet
# Ignore all but the first disk (sda) during the install
ignoredisk --only-use=sda
# Partition clearing information
clearpart --drives=sda --all
zerombr
# Disk partitioning information
part /boot/efi --fstype="efi" --ondisk=sda --size=200 --fsoptions="umask=0077,shortname=winnt"
part /boot --fstype="xfs" --ondisk=sda --size=500
part pv.343 --fstype="lvmpv" --ondisk=sda --size=1 --grow
volgroup rhel --pesize=4096 pv.343
logvol swap --fstype="swap" --size=8000 --name=swap --vgname=rhel
logvol /home --fstype="xfs" --size=51200 --name=home --vgname=rhel
logvol / --fstype="xfs" --size=1 --name=root --vgname=rhel --grow
# define packages to install
%packages
@core
kexec-tools
%end
# add 'kdump' add-on to the install
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
# install epel-release, ansible and git and clone the kragle source repository
%post --log=/root/ks-post.log
/bin/sed -i 's/^ONBOOT=no$/ONBOOT=yes/' /etc/sysconfig/network-scripts/ifcfg-e*
cat > /tmp/postinstall.sh << EOF
#!/bin/bash
# restart the network
systemctl restart network
# Wait for network to come up when using NetworkManager.
if service NetworkManager status >/dev/null 2>&1 && type -P nm-online; then
nm-online -q --timeout=10 || nm-online -q -x --timeout=30
[ "$?" -eq 0 ] || exit 1
fi
# show the network config
ip addr
# register the node. Note that you should replace the following variables in this
# command with valid RHN credentials:
# RHN_USERNAME with the username of an account with a valid subscription
# RHN_PASSWORD with the password for that account
/usr/sbin/subscription-manager register --username RHN_USERNAME --password RHN_PASSWORD --autosubscribe
# enable the rhel7-server-extras repository
/usr/sbin/subscription-manager repos --enable=rhel-7-server-extras-rpms
# install a few packages
yum -y install https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
yum -y install git ansible
# setup localhost so that SSH will always succeed (without asking to verifyt he key)
cat > ~/.ssh/config << EOF2
Host localhost
Hostname localhost
StrictHostKeyChecking no
EOF2
chmod 400 ~/.ssh/config
# clone the kragle repository
cd /tmp
git clone https://github.com/csc/kragle
# run the main ansible playbook from the kragle project
cd kragle
ansible-playbook -i ansible/inventory/hosts.ini ansible/main.yml
# and cleanup
rm -f ~/.ssh/config
sed -i --follow-symlinks '/postinstall/d' /etc/rc.local
# and poweroff the system
poweroff
EOF
echo bash /tmp/postinstall.sh >> /etc/rc.local
chmod +x /tmp/postinstall.sh
# This line needs to be added otherwise rc.local will not execute on boot
chmod +x /etc/rc.d/rc.local
%end