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