first stab at a systemd-compliant nodeimage post script - should turn on openvswitch
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Wed, 13 Feb 2013 08:25:16 +0000 (09:25 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Wed, 13 Feb 2013 08:25:16 +0000 (09:25 +0100)
config.lxc/nodeimage.post [new file with mode: 0644]

diff --git a/config.lxc/nodeimage.post b/config.lxc/nodeimage.post
new file mode 100644 (file)
index 0000000..3231bc5
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+vdir=$1
+if [ -z "${vdir}" ] ; then
+       echo "ERROR: $0"
+       echo "Provide the directory of the root filesystem to operate on"
+       exit
+fi
+
+# Cleanup yum config entirely, waiting for the config files to populate this
+rm -rf ${vdir}/etc/yum.conf ${vdir}/etc/yum.repos.d
+
+# Tweaking services
+# turn ON openvswitch as it is required for the privatebridge nm plugin
+chroot ${vdir} systemctl enable openvswitch.service || :
+# enabling network as it ends up turned off on systems that come with NetworkManager, starting with fedora9
+chroot ${vdir} systemctl enable network.service || :
+# and turn off NetworkManager if present, as it quite obviously messes with network
+chroot ${vdir} systemctl disable NetworkManager || :
+
+# Disable splaying of cron.
+echo > ${vdir}/etc/sysconfig/crontab
+
+# Add site_admin account
+chroot ${vdir} /usr/sbin/useradd -p "" -u 502 -m site_admin
+
+# Add a logrotate script for btmp, which logs failed ssh logins, which can
+# grow unbounded on public plnodes and fill the root fs.
+cat <<EOF > ${vdir}/etc/logrotate.d/btmp
+/var/log/btmp {
+    weekly
+    minsize 1M
+    create 0600 root utmp
+    rotate 2
+    compress
+    notifempty
+}
+EOF
+
+#################### historical notes - see config.planetlab/nodeimage.post
+# xxx turning OFF selinux
+# there used to be some code for that in the historical/vserver version
+# none of that code seems applicable in f16 anylonger
+
+# also a horrible hack to the network initscripts has been removed