Initial ci-management upload
[ci-management.git] / packer / provision / robot.sh
1 #!/bin/bash
2
3 # vim: ts=4 sw=4 sts=4 et tw=72 :
4
5 rh_systems() {
6     # Assumes that python is already installed by basebuild
7
8     # Install dependencies for robotframework and robotframework-sshlibrary
9     yum install -y -q yum-utils unzip sshuttle nc libffi-devel openssl-devel
10
11     # Install docker
12     yum install -y docker supervisor bridge-utils
13     systemctl enable docker
14
15     # configure docker networking so that it does not conflict with LF
16     # internal networks
17     cat <<EOL > /etc/sysconfig/docker-network
18 # /etc/sysconfig/docker-network
19 DOCKER_NETWORK_OPTIONS='--bip=10.250.0.254/24'
20 EOL
21     # configure docker daemon to listen on port 5555 enabling remote
22     # managment
23     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
24
25     # docker group doesn't get created by default for some reason
26     groupadd docker
27
28     # Actual installation of robot is done from an integration JJB script
29 }
30
31 ubuntu_systems() {
32     # Assumes that python is already installed by basebuild
33
34     # Install dependencies for robotframework and robotframework-sshlibrary
35     apt install -y unzip sshuttle netcat libffi-dev libssl-dev
36
37     # Install docker
38     apt install -y docker.io
39
40     # Actual installation of robot is done from an integration JJB script
41 }
42
43 all_systems() {
44     echo 'No common distribution configuration to perform'
45 }
46
47 echo "---> Detecting OS"
48 ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
49
50 case "${ORIGIN}" in
51     fedora|centos|redhat)
52         echo "---> RH type system detected"
53         rh_systems
54     ;;
55     ubuntu)
56         echo "---> Ubuntu system detected"
57         ubuntu_systems
58     ;;
59     *)
60         echo "---> Unknown operating system"
61     ;;
62 esac
63
64 # execute steps for all systems
65 all_systems