# Based on https://wiki.koumbit.net/QwebIrc class qwebirc( $ircserver = 'irc.myserver.com', $ircport = '6667', $realname = 'http://moo.com/', $webirc_mode = 'None', $base_url = 'http://foo.foo.org/', $network_name = 'FooNet', $sslport = false, $feedback_from = 'moo@moo.com', $feedback_to = 'moo@moo.com', $sslfingerprint = false, $webirc_password = false, $ident = 'webchat', $args = '-n -p 3989', $forwarded_for_header = '', $forwarded_for_ips = '' ) { package { [ 'python-twisted', 'python-openssl', 'python-simplejson', 'mercurial' ]: ensure => present, } group { "qwebirc": ensure => present, allowdupe => false, } user { "qwebirc": ensure => present, allowdupe => false, gid => 'qwebirc', require => Group['qwebirc'], } file { '/etc/init.d/qwebirc': ensure => present, owner => root, group => root, mode => 0755, source => 'puppet:///modules/qwebirc/qwebirc-init.d.sh', require => Vcsrepo['/var/lib/qwebirc'], } vcsrepo { "/var/lib/qwebirc": ensure => present, provider => hg, source => 'https://bitbucket.org/rhatto/qwebirc', revision => 'cbc58859a6e1', owner => 'qwebirc', group => 'qwebirc', require => [ User['qwebirc'], Group['qwebirc'], Package['mercurial'] ], notify => Service['qwebirc'], } file { '/var/lib/qwebirc/config.py': ensure => present, owner => 'qwebirc', group => 'qwebirc', mode => 0640, content => template('qwebirc/config.py.erb'), require => Vcsrepo['/var/lib/qwebirc'], } exec { '/var/lib/qwebirc/compile.py': cwd => '/var/lib/qwebirc', creates => '/var/lib/qwebirc/.compiled', user => 'qwebirc', group => 'qwebirc', require => Vcsrepo['/var/lib/qwebirc'], notify => Service['qwebirc'], } exec { '/bin/rm -r /var/lib/qwebirc/.compiled': user => 'qwebirc', group => 'qwebirc', subscribe => File['/var/lib/qwebirc/config.py'], onlyif => 'test -f /var/lib/qwebirc/.compiled', refreshonly => true, } # TODO: check why status is not working service { 'qwebirc': enable => true, ensure => running, hasrestart => true, hasstatus => false, pattern => 'python /var/lib/qwebirc/run.py', require => [ File['/etc/init.d/qwebirc', '/var/lib/qwebirc/config.py' ], Package['python-twisted'] ], } }