puppet manifests for installing Gluon
Change-Id: I7f51ad8f564e9a3aba0f300b92a6c35c27a2e894 Signed-off-by: Szilard Cserey <szilard.cserey@nokia-bell-labs.com>
This commit is contained in:
parent
13b15a9b9c
commit
da99b450bd
|
@ -0,0 +1,2 @@
|
|||
https://pypi.python.org/packages/fe/f6/da82dee704be089b6c3f5a7eb17a5f7c67e4fb6d030405dde392dc846714/python-etcd-0.4.3.tar.gz python-etcd
|
||||
https://pypi.python.org/packages/95/d9/c3336b6b5711c3ab9d1d3a80f1a3e2afeb9d8c02a7166462f6cc96570897/click-6.7.tar.gz#md5=fc4cc00c4863833230d3af92af48abd4a click
|
|
@ -0,0 +1,4 @@
|
|||
notice('MODULAR: gluon-etcd.pp')
|
||||
include gluon
|
||||
|
||||
class { 'gluon::etcd': }
|
|
@ -0,0 +1,4 @@
|
|||
notice('MODULAR: gluon-install.pp')
|
||||
include gluon
|
||||
|
||||
class { 'gluon::install': }
|
|
@ -0,0 +1,4 @@
|
|||
notice('MODULAR: gluon-post.pp')
|
||||
include gluon
|
||||
|
||||
class { 'gluon::post': }
|
|
@ -0,0 +1,51 @@
|
|||
# [member]
|
||||
ETCD_NAME="etcd-01"
|
||||
ETCD_DATA_DIR="/var/lib/etcd"
|
||||
#ETCD_WAL_DIR=""
|
||||
#ETCD_SNAPSHOT_COUNT="10000"
|
||||
#ETCD_HEARTBEAT_INTERVAL="100"
|
||||
#ETCD_ELECTION_TIMEOUT="1000"
|
||||
ETCD_LISTEN_PEER_URLS="http://controller1:2380"
|
||||
ETCD_LISTEN_CLIENT_URLS="http://controller1:2379,http://127.0.0.1:2379"
|
||||
#ETCD_MAX_SNAPSHOTS="5"
|
||||
#ETCD_MAX_WALS="5"
|
||||
#ETCD_CORS=""
|
||||
#
|
||||
#[cluster]
|
||||
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://controller1:2380"
|
||||
# if you use different ETCD_NAME (e.g. test), set ETCD_INITIAL_CLUSTER value for this name, i.e. "test=http://..."
|
||||
ETCD_INITIAL_CLUSTER="etcd-01=http://controller1:2380"
|
||||
ETCD_INITIAL_CLUSTER_STATE="new"
|
||||
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-1"
|
||||
ETCD_ADVERTISE_CLIENT_URLS="http://controller1:2379"
|
||||
#ETCD_DISCOVERY=""
|
||||
#ETCD_DISCOVERY_SRV=""
|
||||
#ETCD_DISCOVERY_FALLBACK="proxy"
|
||||
#ETCD_DISCOVERY_PROXY=""
|
||||
#ETCD_STRICT_RECONFIG_CHECK="false"
|
||||
#
|
||||
#[proxy]
|
||||
#ETCD_PROXY="off"
|
||||
#ETCD_PROXY_FAILURE_WAIT="5000"
|
||||
#ETCD_PROXY_REFRESH_INTERVAL="30000"
|
||||
#ETCD_PROXY_DIAL_TIMEOUT="1000"
|
||||
#ETCD_PROXY_WRITE_TIMEOUT="5000"
|
||||
#ETCD_PROXY_READ_TIMEOUT="0"
|
||||
#
|
||||
#[security]
|
||||
#ETCD_CERT_FILE=""
|
||||
#ETCD_KEY_FILE=""
|
||||
#ETCD_CLIENT_CERT_AUTH="false"
|
||||
#ETCD_TRUSTED_CA_FILE=""
|
||||
#ETCD_PEER_CERT_FILE=""
|
||||
#ETCD_PEER_KEY_FILE=""
|
||||
#ETCD_PEER_CLIENT_CERT_AUTH="false"
|
||||
#ETCD_PEER_TRUSTED_CA_FILE=""
|
||||
#
|
||||
#[logging]
|
||||
#ETCD_DEBUG="false"
|
||||
# examples for -log-package-levels etcdserver=WARNING,security=DEBUG
|
||||
#ETCD_LOG_PACKAGE_LEVELS=""
|
||||
#
|
||||
#[profiling]
|
||||
#ETCD_ENABLE_PPROF="false"
|
|
@ -0,0 +1,60 @@
|
|||
class gluon::etcd inherits gluon
|
||||
{
|
||||
$provider = $operatingsystem ? {
|
||||
ubuntu => 'apt',
|
||||
centos => 'yum',
|
||||
}
|
||||
|
||||
package { 'etcd':
|
||||
ensure => installed,
|
||||
provider => $provider,
|
||||
}->
|
||||
|
||||
file { 'etcd config':
|
||||
ensure => 'file',
|
||||
mode => '0644',
|
||||
path => '/etc/etcd/etcd.conf',
|
||||
source => 'puppet:///modules/gluon/etcd.conf',
|
||||
}->
|
||||
|
||||
firewall { 'etcd':
|
||||
sport => [2380, 2379],
|
||||
dport => [2380, 2379],
|
||||
chain => 'INPUT',
|
||||
proto => tcp,
|
||||
action => 'accept',
|
||||
provider => 'iptables',
|
||||
}->
|
||||
|
||||
exec { 'persist-firewall':
|
||||
command => $operatingsystem ? {
|
||||
'CentOS' => '/sbin/iptables-save > /etc/sysconfig/iptables',
|
||||
},
|
||||
refreshonly => true,
|
||||
}->
|
||||
|
||||
service { 'etcd':
|
||||
name => 'etcd',
|
||||
enable => 'true',
|
||||
ensure => 'running',
|
||||
provider => 'systemd',
|
||||
}->
|
||||
|
||||
exec { 'check etcd status':
|
||||
path => '/bin',
|
||||
command => '/bin/etcdctl cluster-health',
|
||||
logoutput => true,
|
||||
require => Package['etcd'],
|
||||
}
|
||||
|
||||
/*
|
||||
if ($::operatingsystem == 'Ubuntu') {
|
||||
|
||||
}
|
||||
elsif ($::operatingsystem == 'CentOS') {
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
class gluon {
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
class gluon::install inherits gluon {
|
||||
|
||||
package { 'git':
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
package { 'python-pip':
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
package { 'netready':
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
exec { 'setup python-etcd':
|
||||
path => "/bin:/usr/bin",
|
||||
command => "python /opt/netready/python-etcd/setup.py install",
|
||||
cwd => "/opt/netready/python-etcd",
|
||||
logoutput => true,
|
||||
unless => "pip freeze | grep python-etcd",
|
||||
}
|
||||
|
||||
exec { 'setup click':
|
||||
path => "/bin:/usr/bin",
|
||||
command => "python /opt/netready/click/setup.py install",
|
||||
cwd => "/opt/netready/click",
|
||||
logoutput => true,
|
||||
unless => "pip freeze | grep click",
|
||||
}
|
||||
|
||||
exec { 'setup gluon':
|
||||
path => "/bin:/usr/bin",
|
||||
command => "python /opt/netready/gluon/setup.py install",
|
||||
cwd => "/opt/netready/gluon",
|
||||
logoutput => true,
|
||||
unless => "pip freeze | grep gluon",
|
||||
}
|
||||
|
||||
Package <||> ->
|
||||
Exec <||>
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
class gluon::post inherits gluon {
|
||||
|
||||
group { 'proton':
|
||||
name => 'proton',
|
||||
system => true,
|
||||
ensure => present,
|
||||
} ->
|
||||
|
||||
user { 'proton':
|
||||
name => 'proton',
|
||||
groups => 'proton',
|
||||
shell => '/usr/sbin/nologin',
|
||||
home => '/opt/netready',
|
||||
system => true,
|
||||
ensure => present,
|
||||
} ->
|
||||
|
||||
file { [ '/etc/proton', '/var/lib/proton' ]:
|
||||
ensure => 'directory',
|
||||
owner => 'proton',
|
||||
group => 'proton',
|
||||
mode => 'go+w',
|
||||
} ->
|
||||
|
||||
file { '/etc/proton/proton.conf':
|
||||
ensure => 'file',
|
||||
owner => 'proton',
|
||||
group => 'proton',
|
||||
mode => 'go+w',
|
||||
content => "[DEFAULT]
|
||||
state_path = /var/lib/proton",
|
||||
}
|
||||
|
||||
if ($::operatingsystem == 'Ubuntu') {
|
||||
file { '/etc/init/proton-server.conf':
|
||||
source => '/opt/netready/gluon/scripts/proton-server.conf',
|
||||
} ->
|
||||
|
||||
file { '/etc/init.d/proton-server':
|
||||
source => '/opt/netready/gluon/scripts/proton-server',
|
||||
} ->
|
||||
|
||||
service { 'proton-server':
|
||||
ensure => "running",
|
||||
provider => "upstart",
|
||||
require => [ File['/etc/proton/proton.conf'], File['/etc/init/proton-server.conf'], File['/etc/init.d/proton-server'] ],
|
||||
}
|
||||
}
|
||||
elsif ($::operatingsystem == 'CentOS') {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
- id: gluon
|
||||
type: group
|
||||
role: [gluon]
|
||||
requires: [deploy_start]
|
||||
required_for: [deploy_end, primary-controller, controller]
|
||||
tasks: [hiera, setup_repositories, fuel_pkgs, globals, tools, logging, netconfig, gluon_install]
|
||||
parameters:
|
||||
strategy:
|
||||
type: parallel
|
||||
|
||||
- id: gluon_install
|
||||
type: puppet
|
||||
version: 0.0.1
|
||||
groups: [gluon]
|
||||
requires: [deploy_start, openstack-network-end]
|
||||
required_for: [gluon_post]
|
||||
condition:
|
||||
yaql_exp: changedAny($.network_metadata.vips.get('management'), $.gluon)
|
||||
parameters:
|
||||
puppet_manifest: puppet/manifests/gluon-install.pp
|
||||
puppet_modules: puppet/modules:/etc/puppet/modules
|
||||
timeout: 700
|
||||
|
||||
- id: gluon_post
|
||||
type: puppet
|
||||
version: 0.0.1
|
||||
groups: [gluon]
|
||||
requires: [deploy_start, openstack-network-end, gluon_install]
|
||||
condition:
|
||||
yaql_exp: >
|
||||
changedAny($.network_metadata.vips, $.gluon,
|
||||
$.network_metadata.nodes.values().where($.node_roles.contains('gluon')).network_roles.management)
|
||||
parameters:
|
||||
puppet_manifest: puppet/manifests/gluon-post.pp
|
||||
puppet_modules: puppet/modules:/etc/puppet/modules
|
||||
timeout: 700
|
|
@ -0,0 +1,4 @@
|
|||
attributes:
|
||||
metadata:
|
||||
restrictions:
|
||||
- "cluster:net_provider != 'neutron'": "Neutron only"
|
|
@ -0,0 +1,14 @@
|
|||
[Unit]
|
||||
Description=Proton Server
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
NotifyAccess=all
|
||||
TimeoutStartSec=0
|
||||
Restart=always
|
||||
User=proton
|
||||
ExecStart=/usr/bin/proton-server --config-file /etc/proton/proton.conf --log-file=/var/log/proton/proton-server.log
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
mkdir /etc/proton
|
||||
touch /etc/proton/proton.conf
|
||||
|
||||
cat > /etc/proton/proton.conf <<EOF
|
||||
[DEFAULT]
|
||||
state_path = /opt/proton
|
||||
EOF
|
||||
|
||||
chown -R proton:proton /etc/proton
|
||||
chmod -R go+w /etc/proton
|
|
@ -0,0 +1,32 @@
|
|||
# Plugin name
|
||||
name: gluon
|
||||
# Human-readable name for your plugin
|
||||
title: Gluon plugin
|
||||
# Plugin version
|
||||
version: '0.9.0'
|
||||
# Description
|
||||
description: 'This plugin installs Gluon'
|
||||
# Required fuel version
|
||||
fuel_version: ['9.0']
|
||||
# Specify license of your plugin
|
||||
licenses: ['Apache License Version 2.0']
|
||||
# Specify author or company name
|
||||
authors: ['Szilard Cserey']
|
||||
# A link to the plugin's page
|
||||
homepage: 'https://github.com/openstack/fuel-plugin-gluon'
|
||||
# Specify a group which your plugin implements, possible options:
|
||||
# network, storage, storage::cinder, storage::glance, hypervisor
|
||||
groups: ['network']
|
||||
|
||||
# The plugin is compatible with releases in the list
|
||||
releases:
|
||||
- os: ubuntu
|
||||
version: mitaka-9.0
|
||||
mode: ['ha']
|
||||
deployment_scripts_path: deployment_scripts/
|
||||
repository_path: repositories/ubuntu
|
||||
|
||||
# Version of plugin package
|
||||
package_version: '4.0.0'
|
||||
|
||||
is_hotpluggable: false
|
|
@ -0,0 +1,9 @@
|
|||
gluon:
|
||||
name: "Gluon"
|
||||
description: "Install Gluon"
|
||||
has_primary: false # whether has primary role or not
|
||||
public_ip_required: false # whether requires public net or not
|
||||
weight: 150 # weight that will be used for ordering on fuel ui
|
||||
limits:
|
||||
max: 1
|
||||
min: 1
|
|
@ -0,0 +1,111 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
set -eux
|
||||
CACHE=${CACHE:-false}
|
||||
RENEW=${RENEW:-false}
|
||||
DIR="$(dirname `readlink -f $0`)"
|
||||
|
||||
if [ "$CACHE" == true ];then
|
||||
export cache_dir=$DIR/.cache/;
|
||||
if [ -e $cache_dir ] && [[ "$RENEW" == false ]];then
|
||||
export GLUON_REPO=$cache_dir/netready/gluon/;
|
||||
fi
|
||||
fi
|
||||
|
||||
GLUON_REPO="https://github.com/openstack/gluon.git"
|
||||
|
||||
# Version number used in deb/rpm package
|
||||
GLUON_VERSION_NUMBER=${GLUON_VERSION_NUMBER:-0.0.1}
|
||||
GLUON_DESCRIPTION="Gluon"
|
||||
GLUON_BRANCH=${GLUON_BRANCH:-'master'}
|
||||
|
||||
# For which systems gluon package should be build
|
||||
BUILD_FOR=${BUILD_FOR:-ubuntu}
|
||||
|
||||
TMP_DIR="${DIR}/tmp"
|
||||
MODULES="${DIR}/deployment_scripts/puppet/modules"
|
||||
|
||||
#Remove temporary files
|
||||
CLEANUP=${CLEANUP:-true}
|
||||
|
||||
|
||||
function cleanup {
|
||||
rm -rf "${TMP_DIR}"
|
||||
}
|
||||
|
||||
function clone_git_repo {
|
||||
git clone $1
|
||||
if [[ ! -z "${3:-}" ]] && [[ "$3" != "master" ]]; then
|
||||
pushd $2
|
||||
git checkout $3
|
||||
popd
|
||||
fi
|
||||
}
|
||||
|
||||
function download_dependencies {
|
||||
while IFS='\n' read -r line || [[ -n "$line" ]]; do
|
||||
if [[ ! -z $line ]]; then
|
||||
IFS=' ' read -ra arr <<< $line
|
||||
wget "${arr[0]}" -O "${arr[1]}.tar.gz"
|
||||
mkdir "${arr[1]}"
|
||||
tar xvfz "${arr[1]}.tar.gz" -C "${arr[1]}" --strip-components=1
|
||||
rm "${arr[1]}.tar.gz"
|
||||
fi
|
||||
done < "$1"
|
||||
}
|
||||
|
||||
function build_pkg {
|
||||
# clean up
|
||||
rm -rf ${DIR}/repositories/${1}/*
|
||||
case $1 in
|
||||
centos)
|
||||
pushd "${DIR}/repositories/${1}/"
|
||||
#fpm --force -s dir -t rpm --version "${GLUON_VERSION_NUMBER}" --description "${GLUON_DESCRIPTION}" --prefix /opt/opendaylight --rpm-init "${DIR}/gluon_package/${1}/gluon" --after-install "${DIR}/gluon_package/${1}/gluon-post" --name gluon -C "${TMP_DIR}/gluon"
|
||||
#fpm --architecture all --force -s python -t rpm -m 'szilard.cserey@nokia-bell-labs.com' --python-install-lib /usr/lib/python2.7/dist-packages ${TMP_DIR}/gluon/setup.py
|
||||
popd
|
||||
;;
|
||||
ubuntu)
|
||||
pushd "${DIR}/repositories/${1}/"
|
||||
#fpm --architecture all --force -s python -t deb -m 'szilard.cserey@nokia-bell-labs.com' --version "${GLUON_VERSION_NUMBER}" --description "${GLUON_DESCRIPTION}" --deb-upstart "${DIR}/gluon_package/${1}/gluon" --after-install "${DIR}/gluon_package/${1}/gluon-post" --name gluon --python-install-lib /usr/lib/python2.7/dist-packages -d git ${TMP_DIR}/gluon/setup.py
|
||||
fpm --architecture all --force -s dir -t deb -m 'szilard.cserey@nokia-bell-labs.com' --version "${GLUON_VERSION_NUMBER}" --description "${GLUON_DESCRIPTION}" --prefix /opt/netready --name netready -C "${TMP_DIR}/netready"
|
||||
popd
|
||||
;;
|
||||
*) echo "Not supported system"; exit 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
# *********************************************** MAIN ***********************************************
|
||||
|
||||
command -v fpm >/dev/null 2>&1 || { echo >&2 "fpm ruby gem required but it's not installed. Aborting."; exit 1; }
|
||||
|
||||
cleanup
|
||||
|
||||
mkdir -p "${TMP_DIR}/netready"
|
||||
|
||||
pushd "$TMP_DIR/netready"
|
||||
|
||||
clone_git_repo "$GLUON_REPO" "gluon"
|
||||
download_dependencies "${DIR}/dependencies.txt"
|
||||
|
||||
popd
|
||||
|
||||
for system in $BUILD_FOR
|
||||
do
|
||||
build_pkg $system
|
||||
done
|
||||
|
||||
if [ "$CACHE" == true ];then
|
||||
if [ ! -e $cache_dir ] || [[ "$RENEW" == true ]];then
|
||||
rm -rf $cache_dir
|
||||
mkdir -p $cache_dir
|
||||
cp -r ${TMP_DIR}/* ${cache_dir}/
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$CLEANUP" != false ];then
|
||||
cleanup
|
||||
fi
|
|
@ -0,0 +1 @@
|
|||
[]
|
Loading…
Reference in New Issue