Skip to content

Instantly share code, notes, and snippets.

@imesh
Last active August 29, 2015 14:02
Show Gist options
  • Save imesh/f8fd7a40d89dd4b60898 to your computer and use it in GitHub Desktop.
Save imesh/f8fd7a40d89dd4b60898 to your computer and use it in GitHub Desktop.
Install puppet agent and required puppet module to create cartridge image
#!/bin/bash
# ------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
# ------------------------------------------------------------------
# Description: Use this script to install puppet agent and required
# puppet module to create a cartridge image.
#
# Author: imesh@apache.org
# ------------------------------------------------------------------
set -e
stratos_version=4.0.0
stratos_release_version=${stratos_version}-rc4
stratos_dist_path=https://dist.apache.org/repos/dist/dev/stratos/${stratos_release_version}
stratos_source_folder="apache-stratos-${stratos_version}-source-release"
stratos_source_package="apache-stratos-${stratos_version}-source-release.zip"
log=cartridge-creator.log
echo "Installing zip ..." | tee -a ${log}
sudo apt-get -y install zip
pushd /tmp
echo "Downloading source release ..." | tee -a ${log}
wget ${stratos_dist_path}/${stratos_source_package}
echo "Extracting source release ..." | tee -a ${log}
unzip ${stratos_source_package}
echo "Copying files to /root/bin/ ..." | tee -a ${log}
mkdir -p /root/bin
cp -vf ${stratos_source_folder}/tools/puppet3-agent/config.sh /root/bin/
cp -vf ${stratos_source_folder}/tools/puppet3-agent/init.sh /root/bin/
cp -vf ${stratos_source_folder}/tools/puppet3-agent/stratos_sendinfo.rb /root/bin/
mkdir -p /root/bin/puppetinstall
cp -vf ${stratos_source_folder}/tools/puppet3-agent/puppetinstall/puppetinstall /root/bin/puppetinstall/
sed -i 's:^TIMEZONE=.*$:TIMEZONE=\"Etc/UTC\":g' /root/bin/puppetinstall/puppetinstall
echo "Starting config.sh ..."
pushd /root/bin
./config.sh
popd
echo "Removing stratos source files ..."
rm -vf ${stratos_source_package}
rm -rvf ${stratos_source_folder}/
popd
echo "Cartridge image instance is now ready!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment