Merge "Do not pinpoint version of elasticsearch*"
[releng/builder.git] / packer / provision / gbp.sh
1 #!/bin/bash
2
3 # vim: sw=4 ts=4 sts=4 et tw=72 :
4
5 # force any errors to cause the script and job to end in failure
6 set -xeu -o pipefail
7
8 # Ensure that necessary variables are set to enable noninteractive mode in
9 # commands.
10 export DEBIAN_FRONTEND=noninteractive
11
12 # we need garethr-docker in our puppet manifest to install docker
13 # cleanly
14 puppet module install garethr-docker --version 4.1.1
15
16 # do the package install via puppet so that we know it actually installs
17 # properly and it also makes it quieter but with better error reporting
18 echo "---> Installing Group Based Policy requirements"
19 puppet apply /tmp/packer/gbp_packages.pp
20
21 # configure docker networking so that it does not conflict with LF internal networks
22 # configure docker daemon to listen on port 5555 enabling remote managment
23 # This has to happen before docker gets installed or things go sideways
24 # badly
25 cat <<EOL > /etc/default/docker
26 # /etc/default/docker
27 DOCKER_OPTS='-H unix:///var/run/docker.sock -H tcp://0.0.0.0:5555 --bip=10.250.0.254/24'
28 EOL
29
30 # docker
31 echo "---> Installing docker"
32 puppet apply /tmp/packer/docker_setup.pp
33
34 echo "---> stopping docker"
35 puppet apply -e "service { 'docker': ensure => stopped }"
36
37 echo "---> cleaning docker configs that break after snapshotting"
38 rm -f /var/lib/docker/repositories-aufs /etc/docker/key.json
39
40 # OVS
41 echo "---> Installing ovs"
42 puppet module install puppetlabs-vcsrepo
43 puppet apply /tmp/packer/ovs_setup.pp
44
45 pushd /root/ovs
46 DEB_BUILD_OPTIONS='parallel=8 nocheck' fakeroot debian/rules binary | \
47  grep 'dpkg-deb: building package'
48 popd
49
50 # Note this does not actually install OVS. Everytime we've tried to do
51 # that the snapshot system hangs on spin-up for some reason. As such the
52 # final installation will have to be left as a spin-up task
53
54 # The following is what should be used in the spin-up task
55 # dpkg --install /root/openvswitch-datapath-dkms* && dpkg --install /root/openvswitch-{common,switch}*