From 412a0953f356479d34a49cec1eedd21ec06d8857 Mon Sep 17 00:00:00 2001 From: Guillaume Thouvenin Date: Tue, 17 Mar 2015 11:35:22 +0100 Subject: [PATCH] Install Influxdb. Currently the server is not bind to any IP but the nodes has no public IP. Change-Id: Iee1919efda6d8f7e83c02c454faa24369d42a55d --- .../puppet/manifests/influxdb.pp | 9 ++++ pre_build_hook | 48 +++++++++++++++++-- tasks.yaml | 10 +++- 3 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 deployment_scripts/puppet/manifests/influxdb.pp diff --git a/deployment_scripts/puppet/manifests/influxdb.pp b/deployment_scripts/puppet/manifests/influxdb.pp new file mode 100644 index 00000000..9d900e6b --- /dev/null +++ b/deployment_scripts/puppet/manifests/influxdb.pp @@ -0,0 +1,9 @@ +$fuel_settings = parseyaml(file('/etc/astute.yaml')) + +if $fuel_settings['influxdb_grafana']['node_name'] == $fuel_settings['user_node_name'] { + + class { 'influxdb': + install_from_repository => true, + } + +} diff --git a/pre_build_hook b/pre_build_hook index dc05e980..f0ce6344 100755 --- a/pre_build_hook +++ b/pre_build_hook @@ -1,5 +1,47 @@ #!/bin/bash +set -eux -# Add here any the actions which are required before plugin build -# like packages building, packages downloading from mirrors and so on. -# The script should return 0 if there were no errors. +ROOT="$(dirname `readlink -f $0`)" +MODULES="${ROOT}"/deployment_scripts/puppet/modules +RPM_REPO="${ROOT}"/repositories/centos/ +DEB_REPO="${ROOT}"/repositories/ubuntu/ + +# Puppet manifests for influx +INFLUXDB_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/jdowning-influxdb-0.3.0.tar.gz" +STAGING_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/nanliu-staging-1.0.3.tar.gz" + +# Puppet manifests from fuel-lib +FUEL_LIB_VERSION="6.0" +FUEL_LIB_TARBALL_URL="https://github.com/stackforge/fuel-library/archive/${FUEL_LIB_VERSION}.tar.gz" + +# Downloads needed RPM or DEB packages +function download { + case "$1" in + deb) REPO=$DEB_REPO;; + rpm) REPO=$RPM_REPO;; + esac + shift + + while [ $# -gt 0 ]; do + FILE=$(basename $1) + wget -qO - $1 > $REPO/$FILE + shift + done +} + +download deb http://get.influxdb.org/influxdb_0.9.0-rc12_amd64.deb +download rpm http://get.influxdb.org/influxdb-0.9.0_rc12-1.x86_64.rpm + +# Install puppet manifests +# Clean-up first +rm -rf ${MODULES}/{influxdb,staging,stdlib,inifile} +mkdir -p ${MODULES}/{influxdb,staging} + +# Include influxdb manifest from puppetlabs +wget -qO- "${INFLUXDB_TARBALL_URL}" | tar -C "${MODULES}/influxdb" --strip-components=1 -xz +wget -qO- "${STAGING_TARBALL_URL}" | tar -C "${MODULES}/staging" --strip-components=1 -xz + +# Include dependent manifests from fuel-library +wget -qO- "${FUEL_LIB_TARBALL_URL}" | \ + tar -C "${MODULES}" --strip-components=3 -zxvf - \ + fuel-library-${FUEL_LIB_VERSION}/deployment/puppet/{stdlib,inifile} diff --git a/tasks.yaml b/tasks.yaml index 0826e3ec..87c365d1 100644 --- a/tasks.yaml +++ b/tasks.yaml @@ -8,7 +8,7 @@ timeout: 720 # TODO: Configure disks - +# # "reboot" task reboots the nodes and waits until they get back online # - role: 'base-os' # stage: pre_deployment @@ -16,6 +16,12 @@ # parameters: # timeout: 600 -# TODO: install influxdb +- role: ['base-os'] + stage: post_deployment + type: puppet + parameters: + puppet_manifest: puppet/manifests/influxdb.pp + puppet_modules: puppet/modules + timeout: 600 # TODO: install grafana