Skip to content

Commit ee9baef

Browse files
committed
CLOUDSTACK-1066: restore modularity in config files by splitting postinstall tasks
Add config.dat to ensure that openswan install does not hang asking for user input
1 parent 990d20b commit ee9baef

6 files changed

Lines changed: 1018 additions & 3 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Update the box
2+
apt-get -y update
3+
#below are needed for ruby perhaps
4+
apt-get -y install linux-headers-$(uname -r) build-essential
5+
apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev
6+
apt-get -y install curl unzip
7+
apt-get clean
8+
9+
# Set up sudo
10+
echo 'vagrant ALL=NOPASSWD:ALL' > /etc/sudoers.d/vagrant
11+
12+
# Tweak sshd to prevent DNS resolution (speed up logins)
13+
echo 'UseDNS no' >> /etc/ssh/sshd_config
14+
15+
# Remove 5s grub timeout to speed up booting
16+
echo <<EOF > /etc/default/grub
17+
# If you change this file, run 'update-grub' afterwards to update
18+
# /boot/grub/grub.cfg.
19+
20+
GRUB_DEFAULT=0
21+
GRUB_TIMEOUT=0
22+
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
23+
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
24+
GRUB_CMDLINE_LINUX="debian-installer=en_US"
25+
EOF
26+
27+
update-grub
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Clean up
2+
apt-get -y remove linux-headers-$(uname -r) build-essential
3+
apt-get -y autoremove
4+
5+
# Removing leftover leases and persistent rules
6+
echo "cleaning up dhcp leases"
7+
rm /var/lib/dhcp/*
8+
9+
# Make sure Udev doesn't block our network
10+
echo "cleaning up udev rules"
11+
rm /etc/udev/rules.d/70-persistent-net.rules
12+
mkdir /etc/udev/rules.d/70-persistent-net.rules
13+
rm -rf /dev/.udev/
14+
rm /lib/udev/rules.d/75-persistent-net-generator.rules
15+
16+
echo "Adding a 2 sec delay to the interface up, to make the dhclient happy"
17+
echo "pre-up sleep 2" >> /etc/network/interfaces
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
19+
ROOTPW=password
20+
CLOUDSTACK_RELEASE=4.2.0
21+
22+
23+
install_packages() {
24+
DEBIAN_FRONTEND=noninteractive
25+
DEBIAN_PRIORITY=critical
26+
27+
#basic stuff
28+
apt-get --no-install-recommends -q -y --force-yes install rsyslog logrotate cron chkconfig insserv net-tools ifupdown vim-tiny netbase iptables openssh-server grub-legacy e2fsprogs dhcp3-client dnsmasq tcpdump socat wget python bzip2 sed gawk diff grep gzip less tar telnet ftp rsync traceroute psmisc lsof procps monit inetutils-ping iputils-arping httping dnsutils zip unzip ethtool uuid file iproute acpid iptables-persistent virt-what sudo
29+
30+
#sysstat
31+
echo 'sysstat sysstat/enable boolean true' | debconf-set-selections
32+
apt-get --no-install-recommends -q -y --force-yes install sysstat
33+
#apache
34+
apt-get --no-install-recommends -q -y --force-yes install apache2 ssl-cert
35+
#haproxy
36+
apt-get --no-install-recommends -q -y --force-yes install haproxy
37+
#dnsmasq
38+
apt-get --no-install-recommends -q -y --force-yes install dnsmasq
39+
#nfs client
40+
apt-get --no-install-recommends -q -y --force-yes install nfs-common
41+
#vpn stuff
42+
apt-get --no-install-recommends -q -y --force-yes install xl2tpd openswan bcrelay ppp ipsec-tools tdb-tools
43+
#vmware tools
44+
apt-get --no-install-recommends -q -y --force-yes install open-vm-tools
45+
#xenstore utils
46+
apt-get --no-install-recommends -q -y --force-yes install xenstore-utils libxenstore3.0
47+
#keepalived and conntrackd
48+
apt-get --no-install-recommends -q -y --force-yes install keepalived conntrackd ipvsadm libnetfilter-conntrack3 libnl1
49+
#ipcalc
50+
apt-get --no-install-recommends -q -y --force-yes install ipcalc
51+
#java
52+
apt-get --no-install-recommends -q -y --force-yes install default-jre-headless
53+
54+
}
55+
56+
accounts() {
57+
# Setup sudo to allow no-password sudo for "admin"
58+
groupadd -r admin
59+
#create a 'cloud' user
60+
usermod -a -G admin cloud
61+
echo "root:password" | chpasswd
62+
echo "cloud:password" | chpasswd
63+
sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=admin' /etc/sudoers
64+
sed -i -e 's/%admin ALL=(ALL) ALL/%admin ALL=NOPASSWD:ALL/g' /etc/sudoers
65+
66+
mkdir -p /home/cloud/.ssh
67+
chmod 700 /home/cloud/.ssh
68+
69+
}
70+
71+
do_fixes() {
72+
#fix hostname in openssh-server generated keys
73+
sed -i "s/root@\(.*\)$/root@systemvm/g" etc/ssh/ssh_host_*.pub
74+
}
75+
76+
signature() {
77+
touch /var/cache/cloud/cloud-scripts-signature
78+
echo "Cloudstack Release $CLOUDSTACK_RELEASE $(date)" > /etc/cloudstack-release
79+
}
80+
81+
echo "*************INSTALLING PACKAGES********************"
82+
install_packages
83+
echo "*************DONE INSTALLING PACKAGES********************"
84+
accounts
85+
do_fixes
86+
signature

0 commit comments

Comments
 (0)