diff --git a/modules/meetbot/manifests/init.pp b/modules/meetbot/manifests/init.pp index c95ebc7031..9d1328e276 100644 --- a/modules/meetbot/manifests/init.pp +++ b/modules/meetbot/manifests/init.pp @@ -1,47 +1,54 @@ class meetbot { - include apache - vcsrepo { "/opt/meetbot": - ensure => latest, + 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", - system => true, - gid => "meetbot", - require => Group["meetbot"] + user { 'meetbot': + gid => 'meetbot', + home => '/var/lib/meetbot', + shell => '/sbin/nologin', + system => true, + 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": - ensure => directory, - owner => 'meetbot', - require => User['meetbot'] + file { '/var/lib/meetbot': + ensure => directory, + owner => 'meetbot', + require => User['meetbot'], } - file { "/usr/share/pyshared/supybot/plugins/MeetBot": - ensure => directory, + 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": - ensure => absent, + 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 diff --git a/modules/meetbot/manifests/site.pp b/modules/meetbot/manifests/site.pp index 70bc23fc7b..482d4422fe 100644 --- a/modules/meetbot/manifests/site.pp +++ b/modules/meetbot/manifests/site.pp @@ -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", + port => 80, + docroot => "/srv/meetbot-${name}", priority => '50', } - file { "/var/lib/meetbot/${name}": - ensure => directory, - owner => 'meetbot', - require => File["/var/lib/meetbot"] + file { $varlib: + ensure => directory, + owner => 'meetbot', + require => File['/var/lib/meetbot'], } - file { "/srv/meetbot-${name}": + file { $meetbot: ensure => directory, } - file { "/srv/meetbot-${name}/index.html": - ensure => present, - content => template("meetbot/index.html.erb"), - require => File["/srv/meetbot-${name}"] + file { "${meetbot}/index.html": + ensure => present, + content => template('meetbot/index.html.erb'), + require => File[$meetbot], } - file { "/srv/meetbot-${name}/irclogs": - ensure => link, - target => "/var/lib/meetbot/${name}/logs/ChannelLogger/${network}/", - require => File["/srv/meetbot-${name}"] + file { "${meetbot}/irclogs": + ensure => link, + target => "${varlib}/logs/ChannelLogger/${network}", + require => File[$meetbot], } - file { "/srv/meetbot-${name}/meetings": - ensure => link, - target => "/var/lib/meetbot/${name}/meetings/", - require => File["/srv/meetbot-${name}"] + file { "${meetbot}/meetings": + ensure => link, + target => "${varlib}/meetings", + require => File[$meetbot], } - - file { "/var/lib/meetbot/${name}/conf": - ensure => directory, - owner => 'meetbot', - require => File["/var/lib/meetbot/${name}"] + file { [ + "${varlib}/conf", + "${varlib}/data", + "${varlib}/backup", + "${varlib}/logs" + ]: + ensure => directory, + owner => 'meetbot', + require => File[$varlib], } - 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}"] + file { "${varlib}/data/tmp": + ensure => directory, + owner => 'meetbot', + require => File["${varlib}/data"], } # 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 { "${varlib}.conf": + ensure => present, + content => template('meetbot/supybot.conf.erb'), + group => 'root', + notify => Service["${name}-meetbot"], + owner => 'root', + require => File['/var/lib/meetbot'], } - file { "/var/lib/meetbot/${name}/ircmeeting": - ensure => directory, + file { "${varlib}/ircmeeting": + ensure => directory, + owner => 'meetbot', recurse => true, - source => "/opt/meetbot/ircmeeting", - owner => 'meetbot', - require => [Vcsrepo["/opt/meetbot"], - File["/var/lib/meetbot/${name}"]] + require => [ + Vcsrepo['/opt/meetbot'], + File[$varlib] + ], + source => '/opt/meetbot/ircmeeting', } - 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"] + file { "${varlib}/ircmeeting/meetingLocalConfig.py": + ensure => present, + content => template('meetbot/meetingLocalConfig.py.erb'), + notify => Service["${name}-meetbot"], + owner => '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"], - owner => 'root', - notify => Service["${name}-meetbot"] + ensure => present, + content => template('meetbot/upstart.erb'), + notify => Service["${name}-meetbot"], + owner => 'root', + 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"]] + ensure => running, + 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