summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJessica Wagantall <jwagantall@linuxfoundation.org>2017-08-07 23:03:04 +0000
committerGerrit Code Review <gerrit@onap.org>2017-08-07 23:03:04 +0000
commit2bf6570687dbbbb975c025b76b0b3db14da86848 (patch)
tree44dde6959fd7605cbffcda59be00fd8d5e96240c
parentf1b1abab2b7ea09f98c880376100e1c214496fc2 (diff)
parente5f3fc7132e6a4d30afe3f22fcbfb382a097846c (diff)
Merge "Add packer environment with redis installed"
-rw-r--r--packer/provision/redis.sh57
-rw-r--r--packer/templates/redis.json54
2 files changed, 111 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
diff --git a/packer/templates/redis.json b/packer/templates/redis.json
new file mode 100644
index 000000000..7dee6fa3e
--- /dev/null
+++ b/packer/templates/redis.json
@@ -0,0 +1,54 @@
+{
+ "variables": {
+ "stack_tenant": null,
+ "stack_user": null,
+ "stack_pass": null,
+ "stack_network": null,
+ "base_image": null,
+ "cloud_user": null,
+ "distro": null,
+ "cloud_user_data": null
+ },
+ "builders": [
+ {
+ "type": "openstack",
+ "identity_endpoint": "https://auth.vexxhost.net/v2.0/",
+ "tenant_name": "{{user `stack_tenant`}}",
+ "username": "{{user `stack_user`}}",
+ "password": "{{user `stack_pass`}}",
+ "region": "ca-ymq-1",
+ "ssh_username": "{{user `cloud_user`}}",
+ "image_name": "{{user `distro`}} - redis - {{isotime \"20060102-1504\"}}",
+ "source_image_name": "{{user `base_image`}}",
+ "flavor": "v1-standard-1",
+ "availability_zone": "ca-ymq-2",
+ "networks": [
+ "{{user `stack_network`}}"
+ ],
+ "user_data_file": "{{user `cloud_user_data`}}"
+ }
+ ],
+ "provisioners": [
+ {
+ "type": "shell",
+ "inline": [
+ "mkdir -p /tmp/packer"
+ ]
+ },
+ {
+ "type": "file",
+ "source": "provision/basebuild/",
+ "destination": "/tmp/packer"
+ },
+ {
+ "type": "shell",
+ "scripts": [
+ "provision/baseline.sh",
+ "provision/basebuild.sh",
+ "provision/redis.sh",
+ "provision/system_reseal.sh"
+ ],
+ "execute_command": "chmod +x {{ .Path }}; if [ \"$UID\" == \"0\" ]; then {{ .Vars }} '{{ .Path }}'; else {{ .Vars }} sudo -E '{{ .Path }}'; fi"
+ }
+ ]
+}