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
19b6e74761
|
@ -0,0 +1,6 @@
|
|||
*.rpm
|
||||
*.deb
|
||||
.build/
|
||||
.cache/
|
||||
tmp/
|
||||
|
|
@ -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,5 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
notice('MODULAR: gluon-check-etcd-cluster.pp')
|
||||
include gluon
|
||||
|
||||
class { 'gluon::check_etcd_cluster': }
|
|
@ -0,0 +1,5 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
notice('MODULAR: gluon-etcd.pp')
|
||||
include gluon
|
||||
|
||||
class { 'gluon::etcd': }
|
|
@ -0,0 +1,5 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
notice('MODULAR: gluon-install.pp')
|
||||
include gluon
|
||||
|
||||
class { 'gluon::install': }
|
|
@ -0,0 +1,17 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
notice('MODULAR: gluon-neutron-config.pp')
|
||||
include gluon
|
||||
$use_neutron = hiera('use_neutron', false)
|
||||
|
||||
if $use_neutron {
|
||||
neutron_config { 'DEFAULT/core_plugin':
|
||||
value => 'gluon.plugin.core.GluonPlugin',
|
||||
notify => Service['neutron-server'],
|
||||
}
|
||||
|
||||
service { 'neutron-server':
|
||||
name => 'neutron-server',
|
||||
ensure => 'running',
|
||||
provider => 'upstart',
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
notice('MODULAR: gluon-post.pp')
|
||||
include gluon
|
||||
|
||||
class { 'gluon::post': }
|
|
@ -0,0 +1,16 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
|
||||
description "etcd 2.0 distributed key-value store"
|
||||
start on (net-device-up
|
||||
and local-filesystems
|
||||
and runlevel [2345])
|
||||
stop on runlevel [016]
|
||||
respawn
|
||||
respawn limit 10 5
|
||||
script
|
||||
if [ -f "/etc/default/etcd" ]; then
|
||||
. /etc/default/etcd
|
||||
fi
|
||||
chdir /var/lib/etcd
|
||||
exec /usr/local/bin/etcd >>/var/log/etcd/etcd.log 2>&1
|
||||
end script
|
|
@ -0,0 +1,142 @@
|
|||
#! /bin/sh
|
||||
# szilard.cserey@nokia-bell-labs.com
|
||||
### BEGIN INIT INFO
|
||||
# Provides: proton-shim-server
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Should-Start: mysql postgresql rabbitmq-server keystone
|
||||
# Should-Stop: mysql postgresql rabbitmq-server keystone
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: proton-shim-server
|
||||
# Description: Provides the Proton Shim networking service
|
||||
### END INIT INFO
|
||||
set -x
|
||||
DESC="OpenStack Proton Shim Server"
|
||||
PROJECT_NAME=proton
|
||||
NAME=${PROJECT_NAME}-shim-server
|
||||
[ -r /etc/default/proton-shim-server ] && . /etc/default/proton-shim-server
|
||||
[ -r "$PROTON_SHIM_CONFIG" ] && DAEMON_ARGS="--config-file=$PROTON_SHIM_CONFIG"
|
||||
#!/bin/sh
|
||||
# The content after this line comes from openstack-pkg-tools
|
||||
# and has been automatically added to a .init.in script, which
|
||||
# contains only the descriptive part for the daemon. Everything
|
||||
# else is standardized as a single unique script.
|
||||
|
||||
# PATH should only include /usr/* if it runs after the mountnfs.sh script
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
|
||||
|
||||
if [ -z "${DAEMON}" ] ; then
|
||||
DAEMON=/usr/local/bin/${NAME}
|
||||
fi
|
||||
PIDFILE=/var/run/${PROJECT_NAME}/${NAME}.pid
|
||||
if [ -z "${SCRIPTNAME}" ] ; then
|
||||
SCRIPTNAME=/etc/init.d/${NAME}
|
||||
fi
|
||||
if [ -z "${SYSTEM_USER}" ] ; then
|
||||
SYSTEM_USER=${PROJECT_NAME}
|
||||
fi
|
||||
if [ -z "${SYSTEM_USER}" ] ; then
|
||||
SYSTEM_GROUP=${PROJECT_NAME}
|
||||
fi
|
||||
if [ "${SYSTEM_USER}" != "root" ] ; then
|
||||
STARTDAEMON_CHUID="--chuid ${SYSTEM_USER}:${SYSTEM_GROUP}"
|
||||
fi
|
||||
if [ -z "${CONFIG_FILE}" ] ; then
|
||||
CONFIG_FILE=/etc/${PROJECT_NAME}/${PROJECT_NAME}-shim.conf
|
||||
fi
|
||||
LOGDIR=/var/log/${PROJECT_NAME}
|
||||
if [ ! -d "$LOGDIR" ]; then
|
||||
mkdir -p /var/log/${PROJECT_NAME}
|
||||
fi
|
||||
LOGFILE=/var/log/${PROJECT_NAME}/shim.log
|
||||
if [ -z "${NO_OPENSTACK_CONFIG_FILE_DAEMON_ARG}" ] ; then
|
||||
DAEMON_ARGS="${DAEMON_ARGS} --config-file=${CONFIG_FILE}"
|
||||
fi
|
||||
|
||||
# Exit if the package is not installed
|
||||
[ -x $DAEMON ] || exit 0
|
||||
|
||||
# If ran as root, create /var/lock/X, /var/run/X, /var/lib/X and /var/log/X as needed
|
||||
if [ `whoami` = "root" ] ; then
|
||||
for i in lock run log lib ; do
|
||||
mkdir -p /var/$i/${PROJECT_NAME}
|
||||
chown ${SYSTEM_USER} /var/$i/${PROJECT_NAME}
|
||||
done
|
||||
fi
|
||||
|
||||
# This defines init_is_upstart which we use later on (+ more...)
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
# Manage log options: logfile and/or syslog, depending on user's choosing
|
||||
[ -r /etc/default/openstack ] && . /etc/default/openstack
|
||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||
[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
|
||||
[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=$LOGFILE"
|
||||
|
||||
do_start() {
|
||||
start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \
|
||||
--test > /dev/null || return 1
|
||||
start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \
|
||||
-- $DAEMON_ARGS || return 2
|
||||
}
|
||||
|
||||
do_stop() {
|
||||
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
|
||||
RETVAL=$?
|
||||
rm -f $PIDFILE
|
||||
return "$RETVAL"
|
||||
}
|
||||
|
||||
do_systemd_start() {
|
||||
exec $DAEMON $DAEMON_ARGS
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
init_is_upstart > /dev/null 2>&1 && exit 1
|
||||
log_daemon_msg "Starting $DESC" "$NAME"
|
||||
do_start
|
||||
case $? in
|
||||
0|1) log_end_msg 0 ;;
|
||||
2) log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
stop)
|
||||
init_is_upstart > /dev/null 2>&1 && exit 0
|
||||
log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
do_stop
|
||||
case $? in
|
||||
0|1) log_end_msg 0 ;;
|
||||
2) log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
status)
|
||||
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||
;;
|
||||
systemd-start)
|
||||
do_systemd_start
|
||||
;;
|
||||
restart|force-reload)
|
||||
init_is_upstart > /dev/null 2>&1 && exit 1
|
||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
do_stop
|
||||
case $? in
|
||||
0|1)
|
||||
do_start
|
||||
case $? in
|
||||
0) log_end_msg 0 ;;
|
||||
1) log_end_msg 1 ;; # Old process is still running
|
||||
*) log_end_msg 1 ;; # Failed to start
|
||||
esac
|
||||
;;
|
||||
*) log_end_msg 1 ;; # Failed to stop
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|systemd-start}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,28 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
|
||||
description "Proton Shim Server"
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [!2345]
|
||||
|
||||
respawn
|
||||
|
||||
chdir /var/run
|
||||
|
||||
pre-start script
|
||||
mkdir -p /var/run/proton
|
||||
chown proton:root /var/run/proton
|
||||
mkdir -p /var/log/proton
|
||||
chown proton:root /var/log/proton
|
||||
end script
|
||||
|
||||
script
|
||||
[ -x "/usr/local/bin/proton-shim-server" ] || exit 0
|
||||
[ -r /etc/default/openstack ] && . /etc/default/openstack
|
||||
[ -r /etc/default/proton-shim-server ] && . /etc/default/proton-shim-server
|
||||
[ -r "$PROTON_SHIM_CONFIG" ] && DAEMON_ARGS="$DAEMON_ARGS --config-file=$PROTON_SHIM_CONFIG"
|
||||
[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
|
||||
[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/proton/shim.log"
|
||||
exec start-stop-daemon --start --chuid proton --exec /usr/local/bin/proton-shim-server -- \
|
||||
--config-file=/etc/proton/proton-shim.conf ${DAEMON_ARGS}
|
||||
end script
|
|
@ -0,0 +1,36 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
module Puppet::Parser::Functions
|
||||
newfunction(:gluon_get_controller_mgmt_ips, :type => :rvalue) do |args|
|
||||
|
||||
fqdn = function_hiera(['fqdn'])
|
||||
|
||||
net_meta = function_hiera(['network_metadata'])
|
||||
nodes = net_meta['nodes'].values
|
||||
|
||||
cluster = Hash.new
|
||||
cluster_ips = Array.new
|
||||
nodes.each do |node|
|
||||
if node['fqdn'].eql? fqdn then
|
||||
cluster['current'] = node['network_roles']['management']
|
||||
cluster_ips << node['network_roles']['management']
|
||||
next
|
||||
end
|
||||
|
||||
#if node['fqdn'] != fqdn && node['node_roles'].include? 'gluon' then
|
||||
if node['fqdn'] != fqdn && ((node['node_roles'].include? 'controller') || (node['node_roles'].include? 'primary-controller')) then
|
||||
cluster_ips << node['network_roles']['management']
|
||||
end
|
||||
end
|
||||
|
||||
cluster_ips.sort!
|
||||
|
||||
i = 0
|
||||
cluster['all'] = {}
|
||||
cluster_ips.each do |ip|
|
||||
i += 1
|
||||
cluster['all'].merge!({i.to_s => ip})
|
||||
end
|
||||
|
||||
return cluster
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
class gluon::check_etcd_cluster inherits gluon
|
||||
{
|
||||
|
||||
Exec { path => ['/usr/local/bin/', '/bin/'] }
|
||||
|
||||
exec { 'check etcd status':
|
||||
command => 'etcdctl cluster-health | grep "cluster is healthy"',
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
class gluon::etcd inherits gluon
|
||||
{
|
||||
|
||||
$controller_ips = gluon_get_controller_mgmt_ips()
|
||||
Exec { path => ['/usr/local/bin/', '/usr/sbin/', '/usr/bin/', '/bin/'] }
|
||||
|
||||
package { 'etcd':
|
||||
ensure => installed,
|
||||
} ->
|
||||
|
||||
file { '/usr/local/bin/etcd':
|
||||
source => '/opt/etcd/etcd',
|
||||
mode => '0755',
|
||||
} ->
|
||||
|
||||
file { '/usr/local/bin/etcdctl':
|
||||
source => '/opt/etcd/etcdctl',
|
||||
mode => '0755',
|
||||
} ->
|
||||
|
||||
file { '/var/lib/etcd':
|
||||
ensure => 'directory',
|
||||
mode => '0755',
|
||||
} ->
|
||||
|
||||
file { '/var/log/etcd':
|
||||
ensure => 'directory',
|
||||
mode => '0755',
|
||||
} ->
|
||||
|
||||
file { '/etc/init/etcd.conf':
|
||||
ensure => 'file',
|
||||
mode => '0644',
|
||||
source => 'puppet:///modules/gluon/etcd.conf',
|
||||
} ->
|
||||
|
||||
file { '/etc/init/etcd.override':
|
||||
ensure => file,
|
||||
mode => '0644',
|
||||
content => template('gluon/etcd.override.erb'),
|
||||
} ->
|
||||
|
||||
firewall { '000 etcd':
|
||||
dport => [2379, 2380],
|
||||
chain => 'INPUT',
|
||||
proto => 'tcp',
|
||||
action => 'accept',
|
||||
provider => 'iptables',
|
||||
} ->
|
||||
|
||||
exec { 'save iptables':
|
||||
command => $operatingsystem ? {
|
||||
'Ubuntu' => 'invoke-rc.d iptables-persistent save'
|
||||
},
|
||||
refreshonly => true,
|
||||
} ->
|
||||
|
||||
service { 'etcd':
|
||||
name => 'etcd',
|
||||
ensure => 'running',
|
||||
provider => 'upstart',
|
||||
require => [ File['/etc/init/etcd.conf'], File['/etc/init/etcd.override'],
|
||||
File['/var/log/etcd'], File['/var/lib/etcd'],
|
||||
Firewall['000 etcd'] ],
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
class gluon { }
|
|
@ -0,0 +1,43 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
class gluon::install inherits gluon {
|
||||
|
||||
package { 'git':
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
package { 'python-pip':
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
package { 'gluon':
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
exec { 'setup python-etcd':
|
||||
path => "/bin:/usr/bin",
|
||||
command => "python /opt/gluon/python-etcd/setup.py install",
|
||||
cwd => "/opt/gluon/python-etcd",
|
||||
logoutput => true,
|
||||
unless => "pip freeze | grep python-etcd",
|
||||
}
|
||||
|
||||
exec { 'setup click':
|
||||
path => "/bin:/usr/bin",
|
||||
command => "python /opt/gluon/click/setup.py install",
|
||||
cwd => "/opt/gluon/click",
|
||||
logoutput => true,
|
||||
unless => "pip freeze | grep click",
|
||||
}
|
||||
|
||||
exec { 'setup gluon':
|
||||
path => "/bin:/usr/bin",
|
||||
command => "python /opt/gluon/gluon/setup.py install",
|
||||
cwd => "/opt/gluon/gluon",
|
||||
logoutput => true,
|
||||
unless => "pip freeze | grep gluon",
|
||||
}
|
||||
|
||||
Package <||> ->
|
||||
Exec <||>
|
||||
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
class gluon::post inherits gluon {
|
||||
|
||||
Exec { path => ['/usr/sbin/'] }
|
||||
|
||||
group { 'proton':
|
||||
name => 'proton',
|
||||
system => true,
|
||||
ensure => present,
|
||||
} ->
|
||||
|
||||
user { 'proton':
|
||||
name => 'proton',
|
||||
groups => 'proton',
|
||||
shell => '/usr/sbin/nologin',
|
||||
home => '/opt/gluon',
|
||||
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",
|
||||
} ->
|
||||
|
||||
file { '/etc/proton/proton-shim.conf':
|
||||
ensure => 'file',
|
||||
owner => 'proton',
|
||||
group => 'proton',
|
||||
mode => 'go+w',
|
||||
} ->
|
||||
|
||||
firewall { '000 gluon':
|
||||
dport => '2705',
|
||||
chain => 'INPUT',
|
||||
proto => 'tcp',
|
||||
action => 'accept',
|
||||
provider => 'iptables',
|
||||
} ->
|
||||
|
||||
exec { 'save iptables':
|
||||
command => $operatingsystem ? {
|
||||
'Ubuntu' => 'invoke-rc.d iptables-persistent save'
|
||||
},
|
||||
refreshonly => true,
|
||||
}
|
||||
|
||||
if ($::operatingsystem == 'Ubuntu') {
|
||||
|
||||
file { '/etc/init/proton-server.conf':
|
||||
source => '/opt/gluon/gluon/scripts/proton-server.conf',
|
||||
mode => '0644',
|
||||
} ->
|
||||
|
||||
file { '/etc/init.d/proton-server':
|
||||
source => '/opt/gluon/gluon/scripts/proton-server',
|
||||
mode => '0755',
|
||||
} ->
|
||||
|
||||
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'], Firewall['000 gluon'] ],
|
||||
}
|
||||
|
||||
file { '/etc/init/proton-shim-server.conf':
|
||||
source => 'puppet:///modules/gluon/proton-shim-server.conf',
|
||||
mode => '0644',
|
||||
} ->
|
||||
|
||||
file { '/etc/init.d/proton-shim-server':
|
||||
source => 'puppet:///modules/gluon/proton-shim-server',
|
||||
mode => '0755',
|
||||
} ->
|
||||
|
||||
service { 'proton-shim-server':
|
||||
ensure => "running",
|
||||
provider => "upstart",
|
||||
require => [ File['/etc/proton/proton-shim.conf'], File['/etc/init/proton-shim-server.conf'],
|
||||
File['/etc/init.d/proton-shim-server'], Firewall['000 gluon'] ],
|
||||
}
|
||||
|
||||
}
|
||||
elsif ($::operatingsystem == 'CentOS') {
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
# Override file for etcd Upstart script providing some environment variables
|
||||
<%
|
||||
config=''
|
||||
current=''
|
||||
@controller_ips['all'].each_with_index do |ip, i|
|
||||
if ip[0].length == 1 then
|
||||
ip[0] = '0' + ip[0]
|
||||
end
|
||||
if @controller_ips['current'].eql? ip[1] then
|
||||
current = ip[0]
|
||||
end
|
||||
config << "etcd-" + ip[0] + "=http://" + ip[1] + ":2380"
|
||||
if i < (@controller_ips['all'].size - 1) then
|
||||
config << ','
|
||||
end
|
||||
end -%>
|
||||
env ETCD_INITIAL_CLUSTER="<%= config %>"
|
||||
env ETCD_INITIAL_CLUSTER_STATE="new"
|
||||
env ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
|
||||
env ETCD_INITIAL_ADVERTISE_PEER_URLS="http://<%= @controller_ips['current'] %>:2380"
|
||||
env ETCD_DATA_DIR="/var/lib/etcd"
|
||||
env ETCD_LISTEN_PEER_URLS="http://<%= @controller_ips['current'] %>:2380"
|
||||
env ETCD_LISTEN_CLIENT_URLS="http://<%= @controller_ips['current'] %>:2379,http://127.0.0.1:2379"
|
||||
env ETCD_ADVERTISE_CLIENT_URLS="http://<%= @controller_ips['current'] %>:2379"
|
||||
env ETCD_NAME="etcd-<%= current %>"
|
|
@ -0,0 +1,63 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
- 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: etcd
|
||||
type: puppet
|
||||
version: 0.0.1
|
||||
groups: [primary-controller, controller, gluon]
|
||||
required_for: [gluon_install]
|
||||
requires: [deploy_start, openstack-network-end]
|
||||
parameters:
|
||||
puppet_manifest: puppet/manifests/gluon-etcd.pp
|
||||
puppet_modules: puppet/modules:/etc/puppet/modules
|
||||
timeout: 700
|
||||
|
||||
- id: gluon_install
|
||||
type: puppet
|
||||
version: 0.0.1
|
||||
groups: [gluon]
|
||||
requires: [etcd]
|
||||
required_for: [gluon_post]
|
||||
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: [gluon_install]
|
||||
required_for: [gluon_neutron_config]
|
||||
parameters:
|
||||
puppet_manifest: puppet/manifests/gluon-post.pp
|
||||
puppet_modules: puppet/modules:/etc/puppet/modules
|
||||
timeout: 700
|
||||
|
||||
- id: gluon_neutron_config
|
||||
type: puppet
|
||||
version: 0.0.1
|
||||
groups: [gluon]
|
||||
requires: [gluon_post]
|
||||
parameters:
|
||||
puppet_manifest: puppet/manifests/gluon-neutron-config.pp
|
||||
puppet_modules: puppet/modules:/etc/puppet/modules
|
||||
timeout: 700
|
||||
|
||||
#- id: check_etcd_cluster
|
||||
# type: puppet
|
||||
# version: 0.0.1
|
||||
# groups: [gluon]
|
||||
# requires: [gluon_post]
|
||||
# parameters:
|
||||
# puppet_manifest: puppet/manifests/gluon-check-etcd-cluster.pp
|
||||
# puppet_modules: puppet/modules:/etc/puppet/modules
|
||||
# timeout: 700
|
|
@ -0,0 +1,5 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
attributes:
|
||||
metadata:
|
||||
restrictions:
|
||||
- "cluster:net_provider != 'neutron'": "Neutron only"
|
|
@ -0,0 +1,33 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
# 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,10 @@
|
|||
# szilard.cserey@nokia-bell-labs.com
|
||||
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,119 @@
|
|||
#!/bin/bash
|
||||
# szilard.cserey@nokia-bell-labs.com
|
||||
# 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/gluon/gluon/;
|
||||
fi
|
||||
fi
|
||||
|
||||
GLUON_REPO="https://github.com/openstack/gluon.git"
|
||||
ETCD_DL="https://github.com/coreos/etcd/releases/download/v3.1.0/etcd-v3.1.0-linux-amd64.tar.gz"
|
||||
|
||||
# Version number used in deb/rpm package
|
||||
GLUON_VERSION_NUMBER=${GLUON_VERSION_NUMBER:-0.0.1}
|
||||
GLUON_DESCRIPTION="Gluon"
|
||||
GLUON_BRANCH=${GLUON_BRANCH:-'master'}
|
||||
|
||||
ETCD_VERSION_NUMBER=${ETCD_VERSION_NUMBER:-0.0.1}
|
||||
ETCD_DESCRIPTION="etcd"
|
||||
|
||||
# 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_stripped {
|
||||
wget "$1" -O "$2.tar.gz"
|
||||
mkdir "$2"
|
||||
tar xvfz "$2.tar.gz" -C "$2" --strip-components=1
|
||||
rm "$2.tar.gz"
|
||||
}
|
||||
|
||||
function download_dependencies {
|
||||
while IFS='\n' read -r line || [[ -n "$line" ]]; do
|
||||
if [[ ! -z $line ]]; then
|
||||
IFS=' ' read -ra arr <<< $line
|
||||
download_stripped ${arr[0]} ${arr[1]}
|
||||
fi
|
||||
done < "$1"
|
||||
}
|
||||
|
||||
function build_pkg {
|
||||
# clean up
|
||||
rm -rf ${DIR}/repositories/${1}/*
|
||||
case $1 in
|
||||
centos)
|
||||
pushd "${DIR}/repositories/${1}/"
|
||||
#fpm --architecture all --force -s dir -t rpm -m 'szilard.cserey@nokia-bell-labs.com' --version "${GLUON_VERSION_NUMBER}" --description "${GLUON_DESCRIPTION}" --prefix /opt/gluon --name gluon -C "${TMP_DIR}/gluon"
|
||||
#fpm --architecture all --force -s dir -t rpm -m 'szilard.cserey@nokia-bell-labs.com' --version "${ETCD_VERSION_NUMBER}" --description "${ETCD_DESCRIPTION}" --prefix /opt/etcd --name etcd -C "${TMP_DIR}/etcd"
|
||||
popd
|
||||
;;
|
||||
ubuntu)
|
||||
pushd "${DIR}/repositories/${1}/"
|
||||
fpm --architecture all --force -s dir -t deb -m 'szilard.cserey@nokia-bell-labs.com' --version "${GLUON_VERSION_NUMBER}" --description "${GLUON_DESCRIPTION}" --prefix /opt/gluon --name gluon -C "${TMP_DIR}/gluon"
|
||||
fpm --architecture all --force -s dir -t deb -m 'szilard.cserey@nokia-bell-labs.com' --version "${ETCD_VERSION_NUMBER}" --description "${ETCD_DESCRIPTION}" --prefix /opt/etcd --name etcd -C "${TMP_DIR}/etcd"
|
||||
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}/gluon"
|
||||
pushd "$TMP_DIR/gluon"
|
||||
clone_git_repo "$GLUON_REPO" "gluon" "$GLUON_BRANCH"
|
||||
download_dependencies "${DIR}/dependencies.txt"
|
||||
popd
|
||||
|
||||
pushd "$TMP_DIR"
|
||||
download_stripped "$ETCD_DL" "etcd"
|
||||
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