diff options
author | Gary Wu <gary.i.wu@huawei.com> | 2017-08-04 07:09:26 -0700 |
---|---|---|
committer | Gary Wu <gary.i.wu@huawei.com> | 2017-08-04 07:15:11 -0700 |
commit | e5f3fc7132e6a4d30afe3f22fcbfb382a097846c (patch) | |
tree | 248b0e2792fb0f5bc6dff1a8584358ce737db6de /packer/provision/redis.sh | |
parent | 59ac6c3b305ab12c042d9c258775abe46ee76dd5 (diff) |
Add packer environment with redis installed
Change-Id: I964f7a3811df7d5aff61c93fcdaef6307b50373f
Issue-id: CIMAN-14
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'packer/provision/redis.sh')
-rw-r--r-- | packer/provision/redis.sh | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/packer/provision/redis.sh b/packer/provision/redis.sh new file mode 100644 index 000000000..11e2177a1 --- /dev/null +++ b/packer/provision/redis.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# This particular environment was created specifically for vfc-nfvo-lcm + +# vim: ts=4 sw=4 sts=4 et tw=72 : + +# force any errors to cause the script and job to end in failure +set -xeu -o pipefail + +rh_systems() { + # redis + yum install redis + systemctl enable redis.service +} + +ubuntu_systems() { + # redis + + # 1. download and install redis + cd /tmp + wget http://download.redis.io/releases/redis-4.0.1.tar.gz + tar -zxf redis-4.0.1.tar.gz + cd /tmp/redis-4.0.1 + make + make install + + # 2. set conf file and init script + mv /tmp/redis-4.0.1/redis-server /etc/init.d/redis-server + chmod +x /etc/init.d/redis-server + mv /tmp/redis-4.0.1/redis.conf /etc/redis.conf + + # 3. set auto start when start system + update-rc.d redis-server defaults +} + +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 |