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
91
92
|
# 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'] ],
}
}
|