1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# 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') {
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/qwebirc/qwebirc',
revision => '48dfc2ca0def',
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'],
notify => Service['qwebirc'],
}
# See http://hg.qwebirc.org/qwebirc/issue/152/ssl
#file { '/var/lib/qwebirc/qwebirc/ircclient.py':
# ensure => present,
# owner => 'qwebirc',
# group => 'qwebirc',
# mode => 0640,
# source => 'puppet:///modules/qwebirc/ircclient-ssl.py',
# require => Vcsrepo['/var/lib/qwebirc'],
# notify => Service['qwebirc'],
#}
#
#exec { 'qwebirc-revert-ircclient.py':
# command => 'hg revert qwebirc/ircclient.py'
# cwd => '/var/lib/qwebirc',
# user => 'qwebirc',
# group => 'qwebirc',
#}
exec { '/var/lib/qwebirc/compile.py':
cwd => '/var/lib/qwebirc',
creates => '/var/lib/qwebirc/.compiled',
user => 'qwebirc',
group => 'qwebirc',
require => [ User['qwebirc'], Group['qwebirc'], File['/var/lib/qwebirc/qwebirc/ircclient.py'] ],
notify => Service['qwebirc'],
}
# 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',
'/var/lib/qwebirc/qwebirc/ircclient.py'],
Package['python-twisted'] ],
}
}
|