Add Pacemaker Puppet modules

Change-Id: Ic046c03c31bb856978e703e265d76f12eb8e42d9
Implements: blueprint lma-aggregator-in-ha-mode
This commit is contained in:
Simon Pasquier 2015-08-13 20:35:21 +02:00
parent 057152fd0f
commit f7a8439bd7
2 changed files with 55 additions and 38 deletions

46
functions.sh Normal file
View File

@ -0,0 +1,46 @@
#!/bin/bash
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -eux
ROOT="$(dirname "$(readlink -f "$0")")"
MODULES_DIR="${ROOT}"/deployment_scripts/puppet/modules
RPM_REPO="${ROOT}"/repositories/centos/
DEB_REPO="${ROOT}"/repositories/ubuntu/
# Download RPM or DEB packages and store them in the local repository directory
function download_packages {
while [ $# -gt 0 ]; do
if [[ "$1" == *.deb ]]; then
REPO=$DEB_REPO
elif [[ "$1" == *.rpm ]]; then
REPO=$RPM_REPO
else
echo "Invalid URL for download_package(): $1"
fi
FILE=$(basename "$1")
wget -qO - "$1" > "$REPO"/"$FILE"
shift
done
}
# Download official Puppet module and store it in the local directory
function download_puppet_module {
rm -rf "${MODULES_DIR:?}"/"$1"
mkdir -p "${MODULES_DIR}"/"$1"
wget -qO- "$2" | tar -C "${MODULES_DIR}/$1" --strip-components=1 -xz
}

View File

@ -1,10 +1,7 @@
#!/bin/bash
set -eux
ROOT="$(dirname "$(readlink -f "$0")")"
MODULES_DIR="${ROOT}"/deployment_scripts/puppet/modules
RPM_REPO="${ROOT}"/repositories/centos/
DEB_REPO="${ROOT}"/repositories/ubuntu/
. "$(dirname "$(readlink -f "$0")")"/functions.sh
HEKA_VERSION="0.10.0b0"
# This is the commit id for the current stable/6.1 branch
FUEL_LIB_COMMIT="be44e9ea792fe4314ac8c1b7596742ceb5163f61"
@ -14,24 +11,9 @@ APACHE_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/puppetlabs-apache-1
STDLIB_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/puppetlabs-stdlib-4.7.0.tar.gz"
CONCAT_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/puppetlabs-concat-1.2.4.tar.gz"
function download_packages {
while [ $# -gt 0 ]; do
FILENAME=$(basename "$1")
EXT=${FILENAME##*.}
case ${EXT} in
deb) REPO=$DEB_REPO;;
rpm) REPO=$RPM_REPO;;
esac
rm -f "$REPO"/"$FILENAME"
wget -qO - "$1" > "$REPO"/"$FILENAME"
shift
done
}
download_packages \
https://github.com/mozilla-services/heka/releases/download/v${HEKA_VERSION}/heka_${HEKA_VERSION}_amd64.deb > "${DEB_REPO}"/heka_${HEKA_VERSION}_amd64.deb \
https://github.com/mozilla-services/heka/releases/download/v${HEKA_VERSION}/heka-${HEKA_VERSION//./_}-linux-amd64.rpm > "${RPM_REPO}"/heka-${HEKA_VERSION//./_}-linux-amd64.rpm \
https://github.com/mozilla-services/heka/releases/download/v${HEKA_VERSION}/heka_${HEKA_VERSION}_amd64.deb \
https://github.com/mozilla-services/heka/releases/download/v${HEKA_VERSION}/heka-${HEKA_VERSION//./_}-linux-amd64.rpm \
http://mirrors.kernel.org/ubuntu/pool/main/f/fonts-dejavu/fonts-dejavu-core_2.34-1ubuntu1_all.deb \
http://mirrors.kernel.org/ubuntu/pool/main/f/fontconfig/fontconfig-config_2.11.0-0ubuntu4.1_all.deb \
http://mirrors.kernel.org/ubuntu/pool/main/f/fontconfig/libfontconfig1_2.11.0-0ubuntu4.1_amd64.deb \
@ -65,23 +47,12 @@ download_packages \
# Extract dependent manifests from fuel-library
rm -rf "${MODULES_DIR:?}"/{cinder,glance,heat,inifile,keystone,neutron,nova,openstack}
rm -rf "${MODULES_DIR:?}"/{cinder,glance,heat,inifile,keystone,neutron,nova,openstack,pacemaker}
wget -qO- "${FUEL_LIB_TARBALL_URL}" | \
tar -C "${MODULES_DIR}" --strip-components=3 -zxvf - \
fuel-library-${FUEL_LIB_COMMIT}/deployment/puppet/{cinder,glance,heat,inifile,keystone,neutron,nova,openstack}
fuel-library-${FUEL_LIB_COMMIT}/deployment/puppet/{cinder,glance,heat,inifile,keystone,neutron,nova,openstack,pacemaker}
rm -rf "${MODULES_DIR:?}"/collectd
mkdir -p "${MODULES_DIR}"/collectd
wget -qO- "${COLLECTD_TARBALL_URL}" | tar -C "${MODULES_DIR}/collectd" --strip-components=1 -xz
rm -rf "${MODULES_DIR:?}"/apache
mkdir -p "${MODULES_DIR}"/apache
wget -qO- "${APACHE_TARBALL_URL}" | tar -C "${MODULES_DIR}/apache" --strip-components=1 -xz
rm -rf "${MODULES_DIR:?}"/stdlib
mkdir -p "${MODULES_DIR}"/stdlib
wget -qO- "${STDLIB_TARBALL_URL}" | tar -C "${MODULES_DIR}/stdlib" --strip-components=1 -xz
rm -rf "${MODULES_DIR:?}"/concat
mkdir -p "${MODULES_DIR}"/concat
wget -qO- "${CONCAT_TARBALL_URL}" | tar -C "${MODULES_DIR}/concat" --strip-components=1 -xz
download_puppet_module "collectd" "${COLLECTD_TARBALL_URL}"
download_puppet_module "apache" "${APACHE_TARBALL_URL}"
download_puppet_module "stdlib" "${STDLIB_TARBALL_URL}"
download_puppet_module "concat" "${CONCAT_TARBALL_URL}"