Andrew Grimberg | ebc710a | 2017-01-30 12:59:38 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # vim: ts=4 sw=4 sts=4 et tw=72 : |
| 4 | |
Andrew Grimberg | 8ffb213 | 2017-02-07 10:48:06 -0800 | [diff] [blame] | 5 | # force any errors to cause the script and job to end in failure |
Andrew Grimberg | 7fb50b3 | 2017-02-07 10:54:58 -0800 | [diff] [blame] | 6 | set -xeu -o pipefail |
Andrew Grimberg | 8ffb213 | 2017-02-07 10:48:06 -0800 | [diff] [blame] | 7 | |
Andrew Grimberg | ebc710a | 2017-01-30 12:59:38 -0800 | [diff] [blame] | 8 | rh_systems() { |
| 9 | # Assumes that python is already installed by basebuild |
| 10 | |
| 11 | # Install dependencies for robotframework and robotframework-sshlibrary |
Andrew Grimberg | 8ffb213 | 2017-02-07 10:48:06 -0800 | [diff] [blame] | 12 | yum install -y yum-utils unzip sshuttle nc libffi-devel openssl-devel |
Andrew Grimberg | ebc710a | 2017-01-30 12:59:38 -0800 | [diff] [blame] | 13 | |
| 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 |
| 22 | DOCKER_NETWORK_OPTIONS='--bip=10.250.0.254/24' |
| 23 | EOL |
| 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 Grimberg | ebc710a | 2017-01-30 12:59:38 -0800 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | ubuntu_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 Grimberg | ebc710a | 2017-01-30 12:59:38 -0800 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | all_systems() { |
| 43 | echo 'No common distribution configuration to perform' |
| 44 | } |
| 45 | |
| 46 | echo "---> Detecting OS" |
| 47 | ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]') |
| 48 | |
| 49 | case "${ORIGIN}" in |
| 50 | fedora|centos|redhat) |
| 51 | echo "---> RH type system detected" |
| 52 | rh_systems |
| 53 | ;; |
| 54 | ubuntu) |
| 55 | echo "---> Ubuntu system detected" |
| 56 | ubuntu_systems |
| 57 | ;; |
| 58 | *) |
| 59 | echo "---> Unknown operating system" |
| 60 | ;; |
| 61 | esac |
| 62 | |
| 63 | # execute steps for all systems |
| 64 | all_systems |