Puppet Class: exim::config

Defined in:
manifests/config.pp

Overview



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
# File 'manifests/config.pp', line 1

class exim::config {
  $local_domains_txt = join($exim::local_domains, ' : ')
  $relay_to_domains_txt = join($exim::relay_to_domains, ' : ')
  $relay_from_hosts_txt = join($exim::relay_from_hosts + ['localhost'], ' : ')
  $daemon_smtp_ports_txt = join($exim::daemon_smtp_ports, ' : ')
  $never_users_txt = join($exim::never_users, ' : ')
  $host_lookup_txt = join($exim::host_lookup, ' : ')
  $sender_unqualified_hosts_txt = join($exim::sender_unqualified_hosts, ' : ')
  $recipient_unqualified_hosts_txt = join($exim::recipient_unqualified_hosts, ' : ')

  file {
    $exim::config_file:
      ensure  => 'present',
      owner   => 'root',
      group   => $exim::service_group,
      mode    => '0440',
      content => template('exim/exim.conf.erb'),
      notify  => Service[$exim::service_name];
  }

  if $exim::tls_enabled {
    unless $exim::tls_certificate_content and $exim::tls_privatekey_content {
      fail('You must provide tls_certificate_content and tls_privatekey_content when tls_enabled is true')
    }

    if $exim::auth_ldap_enable {
      unless $exim::ldap_hostname and $exim::ldap_base_dn and $exim::ldap_bind_dn and $exim::ldap_passwd {
        fail('You must provide all ldap_* parameters when auth_ldap_enable is true')
      }
    }

    file {
      $exim::tls_certificate_path:
        ensure  => 'present',
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => "${exim::tls_certificate_content}\n",
        notify  => Service[$exim::service_name];

      $exim::tls_privatekey_path:
        ensure    => 'present',
        owner     => 'root',
        group     => $exim::service_group,
        mode      => '0440',
        content   => "${exim::tls_privatekey_content}\n",
        show_diff => false,
        notify    => Service[$exim::service_name];
    }

    # Because file will contain LDAP password
    if $exim::auth_ldap_enable {
      File[$exim::config_file] {
        show_diff => false,
      }
    }
  }

  service {
    $exim::service_name:
      ensure => 'running',
      enable => true;
  }
}