summaryrefslogtreecommitdiff
path: root/manifests/init.pp
blob: 8b6c904441265e8b8659e7c2aecd07f77ebf0f48 (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
# we take rpms from fedora
class dovecot(
  $type          = 'some_unkown_type',
  $sqlite        = false,
  $pgsql         = false,
  $mysql         = false,
  $use_syslog    = true,
  $nagios_checks = {
    'imap-hostname' => $::fqdn,
    'pop3-hostname' => $::fqdn,
  },
  $munin_checks = true,
  $manage_shorewall = true,
  $version = 2
){
  case $operatingsystem {
    centos: { include dovecot::centos }
    debian: { include dovecot::debian }
    default: { include dovecot::base }
  }

  if $dovecot::sqlite or $dovecot::pgsql or $dovecot::mysql {
    include dovecot::sql
  }

  if $dovecot::manage_shorewall {
    include shorewall::rules::pop3
    include shorewall::rules::imap
    if $type == 'proxy' {
      include shorewall::rules::out::imap
      include shorewall::rules::out::pop3
    }
  }

  if $dovecot::munin_checks {
    include dovecot::munin
  }

  if $dovecot::nagios_checks {
    nagios::service{
      "check_imap":
        check_command => "check_imap!${dovecot::nagios_checks['imap-hostname']}!143";
      "check_imap_ssl":
        check_command => "check_imap_ssl!${dovecot::nagios_checks['imap-hostname']}!993";
      "check_pop3":
        check_command => "check_pop3!${dovecot::nagios_checks['pop3-hostname']}!110";
      "check_pop3_ssl":
        check_command => "check_pop3_ssl!${dovecot::nagios_checks['pop3-hostname']}!995";
    }
  }
}