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 {
|
class meetbot {
|
||||||
|
|
||||||
include apache
|
include apache
|
||||||
|
|
||||||
vcsrepo { "/opt/meetbot":
|
vcsrepo { '/opt/meetbot':
|
||||||
ensure => latest,
|
ensure => latest,
|
||||||
provider => git,
|
provider => git,
|
||||||
source => "https://github.com/openstack-ci/meetbot.git",
|
source => 'https://github.com/openstack-ci/meetbot.git',
|
||||||
}
|
}
|
||||||
|
|
||||||
user { "meetbot":
|
user { 'meetbot':
|
||||||
shell => "/sbin/nologin",
|
gid => 'meetbot',
|
||||||
home => "/var/lib/meetbot",
|
home => '/var/lib/meetbot',
|
||||||
system => true,
|
shell => '/sbin/nologin',
|
||||||
gid => "meetbot",
|
system => true,
|
||||||
require => Group["meetbot"]
|
require => Group['meetbot'],
|
||||||
}
|
}
|
||||||
|
|
||||||
group { "meetbot":
|
group { 'meetbot':
|
||||||
ensure => present
|
ensure => present,
|
||||||
}
|
}
|
||||||
|
|
||||||
package { ['supybot', 'python-twisted']:
|
$packages = [
|
||||||
ensure => present
|
'supybot',
|
||||||
|
'python-twisted'
|
||||||
|
]
|
||||||
|
|
||||||
|
package { $packages:
|
||||||
|
ensure => present,
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "/var/lib/meetbot":
|
file { '/var/lib/meetbot':
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
owner => 'meetbot',
|
owner => 'meetbot',
|
||||||
require => User['meetbot']
|
require => User['meetbot'],
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "/usr/share/pyshared/supybot/plugins/MeetBot":
|
file { '/usr/share/pyshared/supybot/plugins/MeetBot':
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
recurse => true,
|
recurse => true,
|
||||||
source => "/opt/meetbot/MeetBot",
|
require => [
|
||||||
require => [Package["supybot"],
|
Package['supybot'],
|
||||||
Vcsrepo["/opt/meetbot"]]
|
Vcsrepo['/opt/meetbot']
|
||||||
|
],
|
||||||
|
source => '/opt/meetbot/MeetBot',
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "/etc/nginx/sites-enabled/default":
|
file { '/etc/nginx/sites-enabled/default':
|
||||||
ensure => absent,
|
ensure => absent,
|
||||||
|
notify => Service['nginx'],
|
||||||
require => Package['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
|
include remove_nginx
|
||||||
|
|
||||||
|
$varlib = "/var/lib/meetbot/${name}"
|
||||||
|
$meetbot = "/srv/meetbot-${name}"
|
||||||
|
|
||||||
apache::vhost { $vhost_name:
|
apache::vhost { $vhost_name:
|
||||||
port => 80,
|
port => 80,
|
||||||
docroot => "/srv/meetbot-$name",
|
docroot => "/srv/meetbot-${name}",
|
||||||
priority => '50',
|
priority => '50',
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "/var/lib/meetbot/${name}":
|
file { $varlib:
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
owner => 'meetbot',
|
owner => 'meetbot',
|
||||||
require => File["/var/lib/meetbot"]
|
require => File['/var/lib/meetbot'],
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "/srv/meetbot-${name}":
|
file { $meetbot:
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "/srv/meetbot-${name}/index.html":
|
file { "${meetbot}/index.html":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
content => template("meetbot/index.html.erb"),
|
content => template('meetbot/index.html.erb'),
|
||||||
require => File["/srv/meetbot-${name}"]
|
require => File[$meetbot],
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "/srv/meetbot-${name}/irclogs":
|
file { "${meetbot}/irclogs":
|
||||||
ensure => link,
|
ensure => link,
|
||||||
target => "/var/lib/meetbot/${name}/logs/ChannelLogger/${network}/",
|
target => "${varlib}/logs/ChannelLogger/${network}",
|
||||||
require => File["/srv/meetbot-${name}"]
|
require => File[$meetbot],
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "/srv/meetbot-${name}/meetings":
|
file { "${meetbot}/meetings":
|
||||||
ensure => link,
|
ensure => link,
|
||||||
target => "/var/lib/meetbot/${name}/meetings/",
|
target => "${varlib}/meetings",
|
||||||
require => File["/srv/meetbot-${name}"]
|
require => File[$meetbot],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file { [
|
||||||
file { "/var/lib/meetbot/${name}/conf":
|
"${varlib}/conf",
|
||||||
ensure => directory,
|
"${varlib}/data",
|
||||||
owner => 'meetbot',
|
"${varlib}/backup",
|
||||||
require => File["/var/lib/meetbot/${name}"]
|
"${varlib}/logs"
|
||||||
|
]:
|
||||||
|
ensure => directory,
|
||||||
|
owner => 'meetbot',
|
||||||
|
require => File[$varlib],
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "/var/lib/meetbot/${name}/data":
|
file { "${varlib}/data/tmp":
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
owner => 'meetbot',
|
owner => 'meetbot',
|
||||||
require => File["/var/lib/meetbot/${name}"]
|
require => File["${varlib}/data"],
|
||||||
}
|
|
||||||
|
|
||||||
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
|
# set to root/root so meetbot doesn't overwrite
|
||||||
file { "/var/lib/meetbot/${name}.conf":
|
file { "${varlib}.conf":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
content => template("meetbot/supybot.conf.erb"),
|
content => template('meetbot/supybot.conf.erb'),
|
||||||
owner => 'root',
|
group => 'root',
|
||||||
group => 'root',
|
notify => Service["${name}-meetbot"],
|
||||||
require => File["/var/lib/meetbot"],
|
owner => 'root',
|
||||||
notify => Service["${name}-meetbot"]
|
require => File['/var/lib/meetbot'],
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "/var/lib/meetbot/${name}/ircmeeting":
|
file { "${varlib}/ircmeeting":
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
|
owner => 'meetbot',
|
||||||
recurse => true,
|
recurse => true,
|
||||||
source => "/opt/meetbot/ircmeeting",
|
require => [
|
||||||
owner => 'meetbot',
|
Vcsrepo['/opt/meetbot'],
|
||||||
require => [Vcsrepo["/opt/meetbot"],
|
File[$varlib]
|
||||||
File["/var/lib/meetbot/${name}"]]
|
],
|
||||||
|
source => '/opt/meetbot/ircmeeting',
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "/var/lib/meetbot/${name}/ircmeeting/meetingLocalConfig.py":
|
file { "${varlib}/ircmeeting/meetingLocalConfig.py":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
content => template("meetbot/meetingLocalConfig.py.erb"),
|
content => template('meetbot/meetingLocalConfig.py.erb'),
|
||||||
owner => 'meetbot',
|
notify => Service["${name}-meetbot"],
|
||||||
require => File["/var/lib/meetbot/${name}/ircmeeting"],
|
owner => 'meetbot',
|
||||||
notify => Service["${name}-meetbot"]
|
require => File["${varlib}/ircmeeting"],
|
||||||
}
|
}
|
||||||
|
|
||||||
# we set this file as root ownership because meetbot overwrites it on shutdown
|
# 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
|
# this means when puppet changes it and restarts meetbot the file is reset
|
||||||
|
|
||||||
file { "/etc/init/${name}-meetbot.conf":
|
file { "/etc/init/${name}-meetbot.conf":
|
||||||
ensure => 'present',
|
ensure => present,
|
||||||
content => template("meetbot/upstart.erb"),
|
content => template('meetbot/upstart.erb'),
|
||||||
replace => 'true',
|
notify => Service["${name}-meetbot"],
|
||||||
require => File["/var/lib/meetbot/${name}.conf"],
|
owner => 'root',
|
||||||
owner => 'root',
|
replace => true,
|
||||||
notify => Service["${name}-meetbot"]
|
require => File["${varlib}.conf"],
|
||||||
}
|
}
|
||||||
|
|
||||||
service { "${name}-meetbot":
|
service { "${name}-meetbot":
|
||||||
provider => upstart,
|
ensure => running,
|
||||||
ensure => running,
|
provider => upstart,
|
||||||
require => [Vcsrepo["/opt/meetbot"],
|
require => [
|
||||||
File["/etc/init/${name}-meetbot.conf"]],
|
Vcsrepo['/opt/meetbot'],
|
||||||
subscribe => [File["/usr/share/pyshared/supybot/plugins/MeetBot"],
|
File["/etc/init/${name}-meetbot.conf"]
|
||||||
File["/var/lib/meetbot/${name}/ircmeeting"]]
|
],
|
||||||
|
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