summaryrefslogtreecommitdiffstats
path: root/packer/provision/redis-server.sh
blob: 9a29b9547b2c15b2892221f63c95374709116c01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash

# vim: ts=4 sw=4 sts=4 et tw=72 :

rh_systems() {
    echo "---> Installing IUS repo and Redis"
    # make sure that IUS is installed
    yum install -y https://centos7.iuscommunity.org/ius-release.rpm
    # now install redis 3.2.x
    yum install -y redis32u
    systemctl enable redis
}

ubuntu_systems() {
    echo "---> Installing Redis"
    # Install redis-server
    apt install -y redis-server
}

all_systems() {
    echo 'No common distribution configuration to perform'
}

echo "---> Detecting OS"
ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')

case "${ORIGIN}" in
    fedora|centos|redhat)
        echo "---> RH type system detected"
        rh_systems
    ;;
    ubuntu)
        echo "---> Ubuntu system detected"
        ubuntu_systems
    ;;
    *)
        echo "---> Unknown operating system"
    ;;
esac

# execute steps for all systems
all_systems