Merge "Puts meetbot under control of puppet"
This commit is contained in:
commit
8c4e305392
@ -253,6 +253,22 @@ node "planet.openstack.org" {
|
||||
}
|
||||
}
|
||||
|
||||
node "meetbot.openstack.org" {
|
||||
class { 'openstack_server':
|
||||
iptables_public_tcp_ports => [80]
|
||||
}
|
||||
include meetbot
|
||||
|
||||
meetbot::site { "openstack":
|
||||
nick => "openstack",
|
||||
network => "FreeNode",
|
||||
server => "chat.us.freenode.net:7000",
|
||||
url => "meetbot.openstack.org",
|
||||
channels => "#openstack #openstack-dev #openstack-meeting",
|
||||
use_ssl => "True"
|
||||
}
|
||||
}
|
||||
|
||||
# A bare machine, but with a jenkins user
|
||||
node /^.*\.template\.openstack\.org$/ {
|
||||
class { 'openstack_template':
|
||||
|
65
modules/meetbot/manifests/init.pp
Normal file
65
modules/meetbot/manifests/init.pp
Normal file
@ -0,0 +1,65 @@
|
||||
class vcs {
|
||||
# if we already have the git repo the pull updates
|
||||
|
||||
exec { "update_meetbot_repo":
|
||||
command => "git pull --ff-only",
|
||||
cwd => "/tmp/meetbot",
|
||||
path => "/bin:/usr/bin",
|
||||
onlyif => "test -d /tmp/meetbot"
|
||||
}
|
||||
|
||||
# otherwise get a new clone of it
|
||||
|
||||
exec { "clone_meebot_repo":
|
||||
command => "git clone https://github.com/emonty/meetbot.git /tmp/meetbot",
|
||||
path => "/bin:/usr/bin",
|
||||
onlyif => "test ! -d /tmp/meetbot"
|
||||
}
|
||||
}
|
||||
|
||||
class meetbot {
|
||||
stage { 'first': before => Stage['main'] }
|
||||
class { 'vcs':
|
||||
stage => 'first'
|
||||
}
|
||||
|
||||
user { "meetbot":
|
||||
shell => "/sbin/nologin",
|
||||
home => "/var/lib/meetbot",
|
||||
system => true,
|
||||
gid => "meetbot",
|
||||
require => Group["meetbot"]
|
||||
}
|
||||
|
||||
group { "meetbot":
|
||||
ensure => present
|
||||
}
|
||||
|
||||
package { ['supybot', 'nginx', 'python-twisted']:
|
||||
ensure => present
|
||||
}
|
||||
|
||||
service { "nginx":
|
||||
ensure => running,
|
||||
hasrestart => true
|
||||
}
|
||||
|
||||
file { "/var/lib/meetbot":
|
||||
ensure => directory,
|
||||
owner => 'meetbot',
|
||||
require => User['meetbot']
|
||||
}
|
||||
|
||||
file { "/usr/share/pyshared/supybot/plugins/MeetBot":
|
||||
ensure => directory,
|
||||
recurse => true,
|
||||
source => "/tmp/meetbot/MeetBot",
|
||||
require => Package["supybot"]
|
||||
}
|
||||
|
||||
file { "/etc/nginx/sites-enabled/default":
|
||||
ensure => absent,
|
||||
require => Package['nginx']
|
||||
}
|
||||
|
||||
}
|
96
modules/meetbot/manifests/site.pp
Normal file
96
modules/meetbot/manifests/site.pp
Normal file
@ -0,0 +1,96 @@
|
||||
define meetbot::site($nick, $network, $server, $url, $channels, $use_ssl) {
|
||||
|
||||
file { "/etc/nginx/sites-available/${name}-meetbot":
|
||||
ensure => 'present',
|
||||
content => template("meetbot/nginx.erb"),
|
||||
replace => 'true',
|
||||
require => Package[nginx],
|
||||
notify => Service[nginx]
|
||||
}
|
||||
|
||||
file { "/etc/nginx/sites-enabled/${name}-meetbot":
|
||||
ensure => link,
|
||||
target => "/etc/nginx/sites-available/${name}-meetbot",
|
||||
require => Package[nginx]
|
||||
}
|
||||
|
||||
file { "/var/lib/meetbot/${name}":
|
||||
ensure => directory,
|
||||
owner => 'meetbot',
|
||||
require => File["/var/lib/meetbot"]
|
||||
}
|
||||
|
||||
file { "/var/lib/meetbot/${name}/conf":
|
||||
ensure => directory,
|
||||
owner => 'meetbot',
|
||||
require => File["/var/lib/meetbot/${name}"]
|
||||
}
|
||||
|
||||
file { "/var/lib/meetbot/${name}/data":
|
||||
ensure => directory,
|
||||
owner => 'meetbot',
|
||||
require => File["/var/lib/meetbot/${name}"]
|
||||
}
|
||||
|
||||
file { "/var/lib/meetbot/${name}/data/tmp":
|
||||
ensure => directory,
|
||||
owner => 'meetbot',
|
||||
require => File["/var/lib/meetbot/${name}/data"]
|
||||
}
|
||||
|
||||
file { "/var/lib/meetbot/${name}/backup":
|
||||
ensure => directory,
|
||||
owner => 'meetbot',
|
||||
require => File["/var/lib/meetbot/${name}"]
|
||||
}
|
||||
|
||||
file { "/var/lib/meetbot/${name}/logs":
|
||||
ensure => directory,
|
||||
owner => 'meetbot',
|
||||
require => File["/var/lib/meetbot/${name}"]
|
||||
}
|
||||
|
||||
# set to root/root so meetbot doesn't overwrite
|
||||
file { "/var/lib/meetbot/${name}.conf":
|
||||
ensure => present,
|
||||
content => template("meetbot/supybot.conf.erb"),
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
require => File["/var/lib/meetbot"],
|
||||
notify => Service["${name}-meetbot"]
|
||||
}
|
||||
|
||||
file { "/var/lib/meetbot/${name}/ircmeeting":
|
||||
ensure => directory,
|
||||
recurse => true,
|
||||
source => "/tmp/meetbot/ircmeeting",
|
||||
owner => 'meetbot',
|
||||
require => File["/var/lib/meetbot/${name}"]
|
||||
}
|
||||
|
||||
file { "/var/lib/meetbot/${name}/ircmeeting/meetingLocalConfig.py":
|
||||
ensure => present,
|
||||
content => template("meetbot/meetingLocalConfig.py.erb"),
|
||||
owner => 'meetbot',
|
||||
require => File["/var/lib/meetbot/${name}/ircmeeting"],
|
||||
notify => Service["${name}-meetbot"]
|
||||
}
|
||||
|
||||
# we set this file as root ownership because meetbot overwrites it on shutdown
|
||||
# this means when puppet changes it and restarts meetbot the file is reset
|
||||
|
||||
file { "/etc/init/${name}-meetbot.conf":
|
||||
ensure => 'present',
|
||||
content => template("meetbot/upstart.erb"),
|
||||
replace => 'true',
|
||||
require => File["/var/lib/meetbot/${name}.conf"],
|
||||
owner => 'root',
|
||||
notify => Service["${name}-meetbot"]
|
||||
}
|
||||
|
||||
service { "${name}-meetbot":
|
||||
provider => upstart,
|
||||
ensure => running,
|
||||
require => File["/etc/init/${name}-meetbot.conf"]
|
||||
}
|
||||
}
|
4
modules/meetbot/templates/meetingLocalConfig.py.erb
Normal file
4
modules/meetbot/templates/meetingLocalConfig.py.erb
Normal file
@ -0,0 +1,4 @@
|
||||
class Config(object):
|
||||
# These two are **required**:
|
||||
logFileDir = '/var/lib/meetbot/<%= name %>/meetings/'
|
||||
logUrlPrefix = 'http://<%= url %>/meetings/'
|
9
modules/meetbot/templates/nginx.erb
Normal file
9
modules/meetbot/templates/nginx.erb
Normal file
@ -0,0 +1,9 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name <%= url %>;
|
||||
root /var/lib/meetbot/<%= name %>;
|
||||
|
||||
location /meetings {
|
||||
autoindex on;
|
||||
}
|
||||
}
|
1420
modules/meetbot/templates/supybot.conf.erb
Normal file
1420
modules/meetbot/templates/supybot.conf.erb
Normal file
File diff suppressed because it is too large
Load Diff
9
modules/meetbot/templates/upstart.erb
Normal file
9
modules/meetbot/templates/upstart.erb
Normal file
@ -0,0 +1,9 @@
|
||||
description "<%= name %> Meetbot Server"
|
||||
author "Andrew Hutchings <andrew@linuxjedi.co.uk>"
|
||||
|
||||
start on (local-filesystem and net-device-up)
|
||||
stop on runlevel [!2345]
|
||||
|
||||
env PYTHONPATH=/var/lib/meetbot/<%= name %>
|
||||
|
||||
exec start-stop-daemon --start --chdir /var/lib/meetbot/openstack --chuid meetbot --name meetbot --startas /usr/bin/python /usr/bin/supybot /var/lib/meetbot/<%= name %>.conf
|
Loading…
Reference in New Issue
Block a user