Puppet-lint / Refactor meetbot module
This started as a puppet-lint clean up and ended up more a refactoring of some of the logic. Change-Id: I5315571fbef8ff4ebe2ae77d2d2b19a6fcd5798d Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com> Reviewed-on: https://review.openstack.org/14113 Reviewed-by: James E. Blair <corvus@inaugust.com> Approved: Monty Taylor <mordred@inaugust.com> Reviewed-by: Monty Taylor <mordred@inaugust.com> Tested-by: Jenkins
This commit is contained in:
parent
39494862c8
commit
da3e3b72e9
@ -1,47 +1,54 @@
|
||||
class meetbot {
|
||||
|
||||
include apache
|
||||
|
||||
vcsrepo { "/opt/meetbot":
|
||||
vcsrepo { '/opt/meetbot':
|
||||
ensure => latest,
|
||||
provider => git,
|
||||
source => "https://github.com/openstack-ci/meetbot.git",
|
||||
source => 'https://github.com/openstack-ci/meetbot.git',
|
||||
}
|
||||
|
||||
user { "meetbot":
|
||||
shell => "/sbin/nologin",
|
||||
home => "/var/lib/meetbot",
|
||||
user { 'meetbot':
|
||||
gid => 'meetbot',
|
||||
home => '/var/lib/meetbot',
|
||||
shell => '/sbin/nologin',
|
||||
system => true,
|
||||
gid => "meetbot",
|
||||
require => Group["meetbot"]
|
||||
require => Group['meetbot'],
|
||||
}
|
||||
|
||||
group { "meetbot":
|
||||
ensure => present
|
||||
group { 'meetbot':
|
||||
ensure => present,
|
||||
}
|
||||
|
||||
package { ['supybot', 'python-twisted']:
|
||||
ensure => present
|
||||
$packages = [
|
||||
'supybot',
|
||||
'python-twisted'
|
||||
]
|
||||
|
||||
package { $packages:
|
||||
ensure => present,
|
||||
}
|
||||
|
||||
file { "/var/lib/meetbot":
|
||||
file { '/var/lib/meetbot':
|
||||
ensure => directory,
|
||||
owner => 'meetbot',
|
||||
require => User['meetbot']
|
||||
require => User['meetbot'],
|
||||
}
|
||||
|
||||
file { "/usr/share/pyshared/supybot/plugins/MeetBot":
|
||||
file { '/usr/share/pyshared/supybot/plugins/MeetBot':
|
||||
ensure => directory,
|
||||
recurse => true,
|
||||
source => "/opt/meetbot/MeetBot",
|
||||
require => [Package["supybot"],
|
||||
Vcsrepo["/opt/meetbot"]]
|
||||
require => [
|
||||
Package['supybot'],
|
||||
Vcsrepo['/opt/meetbot']
|
||||
],
|
||||
source => '/opt/meetbot/MeetBot',
|
||||
}
|
||||
|
||||
file { "/etc/nginx/sites-enabled/default":
|
||||
file { '/etc/nginx/sites-enabled/default':
|
||||
ensure => absent,
|
||||
notify => Service['nginx'],
|
||||
require => Package['nginx'],
|
||||
notify => Service['nginx']
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# vim:sw=2:ts=2:expandtab:textwidth=79
|
||||
|
@ -1,117 +1,120 @@
|
||||
define meetbot::site($nick, $nickpass, $network, $server, $vhost_name=$fqdn, $channels, $use_ssl) {
|
||||
|
||||
define meetbot::site(
|
||||
$channels,
|
||||
$network,
|
||||
$nick,
|
||||
$nickpass,
|
||||
$server,
|
||||
$use_ssl,
|
||||
$vhost_name = $::fqdn
|
||||
) {
|
||||
include remove_nginx
|
||||
|
||||
$varlib = "/var/lib/meetbot/${name}"
|
||||
$meetbot = "/srv/meetbot-${name}"
|
||||
|
||||
apache::vhost { $vhost_name:
|
||||
port => 80,
|
||||
docroot => "/srv/meetbot-$name",
|
||||
docroot => "/srv/meetbot-${name}",
|
||||
priority => '50',
|
||||
}
|
||||
|
||||
file { "/var/lib/meetbot/${name}":
|
||||
file { $varlib:
|
||||
ensure => directory,
|
||||
owner => 'meetbot',
|
||||
require => File["/var/lib/meetbot"]
|
||||
require => File['/var/lib/meetbot'],
|
||||
}
|
||||
|
||||
file { "/srv/meetbot-${name}":
|
||||
file { $meetbot:
|
||||
ensure => directory,
|
||||
}
|
||||
|
||||
file { "/srv/meetbot-${name}/index.html":
|
||||
file { "${meetbot}/index.html":
|
||||
ensure => present,
|
||||
content => template("meetbot/index.html.erb"),
|
||||
require => File["/srv/meetbot-${name}"]
|
||||
content => template('meetbot/index.html.erb'),
|
||||
require => File[$meetbot],
|
||||
}
|
||||
|
||||
file { "/srv/meetbot-${name}/irclogs":
|
||||
file { "${meetbot}/irclogs":
|
||||
ensure => link,
|
||||
target => "/var/lib/meetbot/${name}/logs/ChannelLogger/${network}/",
|
||||
require => File["/srv/meetbot-${name}"]
|
||||
target => "${varlib}/logs/ChannelLogger/${network}",
|
||||
require => File[$meetbot],
|
||||
}
|
||||
|
||||
file { "/srv/meetbot-${name}/meetings":
|
||||
file { "${meetbot}/meetings":
|
||||
ensure => link,
|
||||
target => "/var/lib/meetbot/${name}/meetings/",
|
||||
require => File["/srv/meetbot-${name}"]
|
||||
target => "${varlib}/meetings",
|
||||
require => File[$meetbot],
|
||||
}
|
||||
|
||||
|
||||
file { "/var/lib/meetbot/${name}/conf":
|
||||
file { [
|
||||
"${varlib}/conf",
|
||||
"${varlib}/data",
|
||||
"${varlib}/backup",
|
||||
"${varlib}/logs"
|
||||
]:
|
||||
ensure => directory,
|
||||
owner => 'meetbot',
|
||||
require => File["/var/lib/meetbot/${name}"]
|
||||
require => File[$varlib],
|
||||
}
|
||||
|
||||
file { "/var/lib/meetbot/${name}/data":
|
||||
file { "${varlib}/data/tmp":
|
||||
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}"]
|
||||
require => File["${varlib}/data"],
|
||||
}
|
||||
|
||||
# set to root/root so meetbot doesn't overwrite
|
||||
file { "/var/lib/meetbot/${name}.conf":
|
||||
file { "${varlib}.conf":
|
||||
ensure => present,
|
||||
content => template("meetbot/supybot.conf.erb"),
|
||||
owner => 'root',
|
||||
content => template('meetbot/supybot.conf.erb'),
|
||||
group => 'root',
|
||||
require => File["/var/lib/meetbot"],
|
||||
notify => Service["${name}-meetbot"]
|
||||
notify => Service["${name}-meetbot"],
|
||||
owner => 'root',
|
||||
require => File['/var/lib/meetbot'],
|
||||
}
|
||||
|
||||
file { "/var/lib/meetbot/${name}/ircmeeting":
|
||||
file { "${varlib}/ircmeeting":
|
||||
ensure => directory,
|
||||
recurse => true,
|
||||
source => "/opt/meetbot/ircmeeting",
|
||||
owner => 'meetbot',
|
||||
require => [Vcsrepo["/opt/meetbot"],
|
||||
File["/var/lib/meetbot/${name}"]]
|
||||
recurse => true,
|
||||
require => [
|
||||
Vcsrepo['/opt/meetbot'],
|
||||
File[$varlib]
|
||||
],
|
||||
source => '/opt/meetbot/ircmeeting',
|
||||
}
|
||||
|
||||
file { "/var/lib/meetbot/${name}/ircmeeting/meetingLocalConfig.py":
|
||||
file { "${varlib}/ircmeeting/meetingLocalConfig.py":
|
||||
ensure => present,
|
||||
content => template("meetbot/meetingLocalConfig.py.erb"),
|
||||
content => template('meetbot/meetingLocalConfig.py.erb'),
|
||||
notify => Service["${name}-meetbot"],
|
||||
owner => 'meetbot',
|
||||
require => File["/var/lib/meetbot/${name}/ircmeeting"],
|
||||
notify => Service["${name}-meetbot"]
|
||||
require => File["${varlib}/ircmeeting"],
|
||||
}
|
||||
|
||||
# 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"],
|
||||
ensure => present,
|
||||
content => template('meetbot/upstart.erb'),
|
||||
notify => Service["${name}-meetbot"],
|
||||
owner => 'root',
|
||||
notify => Service["${name}-meetbot"]
|
||||
replace => true,
|
||||
require => File["${varlib}.conf"],
|
||||
}
|
||||
|
||||
service { "${name}-meetbot":
|
||||
provider => upstart,
|
||||
ensure => running,
|
||||
require => [Vcsrepo["/opt/meetbot"],
|
||||
File["/etc/init/${name}-meetbot.conf"]],
|
||||
subscribe => [File["/usr/share/pyshared/supybot/plugins/MeetBot"],
|
||||
File["/var/lib/meetbot/${name}/ircmeeting"]]
|
||||
provider => upstart,
|
||||
require => [
|
||||
Vcsrepo['/opt/meetbot'],
|
||||
File["/etc/init/${name}-meetbot.conf"]
|
||||
],
|
||||
subscribe => [
|
||||
File['/usr/share/pyshared/supybot/plugins/MeetBot'],
|
||||
File["${varlib}/ircmeeting"]
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
# vim:sw=2:ts=2:expandtab:textwidth=79
|
||||
|
Loading…
x
Reference in New Issue
Block a user