config.pp 1.11 KB
Newer Older
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
#
#== Definition: postfix::config
#
#Uses the "postconf" command to add/alter/remove options in postfix main
#configuation file (/etc/postfix/main.cf).
#
#Parameters:
#- *name*: name of the parameter.
#- *ensure*: present/absent. defaults to present.
#- *value*: value of the parameter.
#
#Requires:
#- Class["postfix"]
#
#Example usage:
#
#  node "toto.example.com" {
#
#    include postfix
#
#    postfix::config {
#      "smtp_use_tls"            => "yes";
#      "smtp_sasl_auth_enable"   => "yes";
#      "smtp_sasl_password_maps" => "hash:/etc/postfix/my_sasl_passwords";
#      "relayhost"               => "[mail.example.com]:587";
#    }
#  }
#
#
define postfix::config ($value, $ensure = present) {
31
32

  Augeas {
33
34
    incl    => '/etc/postfix/main.cf',
    lens    => 'Postfix_Main.lns',
35
36
    notify  => Service['postfix'],
    require => File['/etc/postfix/main.cf'],
37
38
  }

39
40
  case $ensure {
    present: {
fredj's avatar
fredj committed
41
      augeas { "set postfix '${name}' to '${value}'":
42
        changes => "set $name $value",
43
44
45
      }
    }
    absent: {
fredj's avatar
fredj committed
46
      augeas { "rm postfix '${name}'":
47
48
        changes => "rm $name",
      }
49
    }
50
    default: {}
51
52
  }
}