summaryrefslogtreecommitdiff
path: root/manifests/init.pp
blob: 3e50670b1ade30a959ff83dfa68d27fba7fdd5b7 (plain)
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
# 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) {

  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 => '19d6068a1aa6',
    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'],
  }

  service { 'qwebirc':
    enable     => true,
    ensure     => running,
    hasrestart => true,
    hasstatus  => true,
    require    => [ File['/etc/init.d/qwebirc', '/var/lib/qwebirc/config.py',
                         '/var/lib/qwebirc/qwebirc/ircclient.py'],
                    Package['python-twisted'] ],
  }
}