blob: 739ba42937005655e68a46d29e4a62d1cc2f6300 [file] [log] [blame]
Andrew Grimbergebc710a2017-01-30 12:59:38 -08001#!/bin/bash
2
3# vim: ts=4 sw=4 sts=4 et tw=72 :
4
Andrew Grimberg8ffb2132017-02-07 10:48:06 -08005# force any errors to cause the script and job to end in failure
Andrew Grimberg7fb50b32017-02-07 10:54:58 -08006set -xeu -o pipefail
Andrew Grimberg8ffb2132017-02-07 10:48:06 -08007
Andrew Grimbergebc710a2017-01-30 12:59:38 -08008rh_systems() {
9 # Assumes that python is already installed by basebuild
10
11 # Install dependencies for robotframework and robotframework-sshlibrary
Andrew Grimberg8ffb2132017-02-07 10:48:06 -080012 yum install -y yum-utils unzip sshuttle nc libffi-devel openssl-devel
Andrew Grimbergebc710a2017-01-30 12:59:38 -080013
14 # Install docker
15 yum install -y docker supervisor bridge-utils
16 systemctl enable docker
17
18 # configure docker networking so that it does not conflict with LF
19 # internal networks
20 cat <<EOL > /etc/sysconfig/docker-network
21# /etc/sysconfig/docker-network
22DOCKER_NETWORK_OPTIONS='--bip=10.250.0.254/24'
23EOL
24 # configure docker daemon to listen on port 5555 enabling remote
25 # managment
26 sed -i -e "s#='--selinux-enabled'#='--selinux-enabled -H unix:///var/run/docker.sock -H tcp://0.0.0.0:5555'#g" /etc/sysconfig/docker
27
28 # docker group doesn't get created by default for some reason
29 groupadd docker
Andrew Grimbergebc710a2017-01-30 12:59:38 -080030}
31
32ubuntu_systems() {
33 # Assumes that python is already installed by basebuild
34
35 # Install dependencies for robotframework and robotframework-sshlibrary
36 apt install -y unzip sshuttle netcat libffi-dev libssl-dev
37
38 # Install docker
39 apt install -y docker.io
Andrew Grimbergebc710a2017-01-30 12:59:38 -080040}
41
42all_systems() {
Gary Wu86f7b4e2017-08-17 12:20:26 -070043 # Install docker-compose
44 curl -o /usr/local/bin/docker-compose -L "https://github.com/docker/compose/releases/download/1.15.0/docker-compose-$(uname -s)-$(uname -m)"
45 chmod +x /usr/local/bin/docker-compose
46 docker-compose -v
Andrew Grimbergebc710a2017-01-30 12:59:38 -080047}
48
49echo "---> Detecting OS"
50ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
51
52case "${ORIGIN}" in
53 fedora|centos|redhat)
54 echo "---> RH type system detected"
55 rh_systems
56 ;;
57 ubuntu)
58 echo "---> Ubuntu system detected"
59 ubuntu_systems
60 ;;
61 *)
62 echo "---> Unknown operating system"
63 ;;
64esac
65
66# execute steps for all systems
67all_systems