aboutsummaryrefslogtreecommitdiff
path: root/manifests/server.pp
blob: b8e94b0bee5eb27a44b9a755b6eb3789f0e6f1ae (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
class samba::server($server_string = '',
                    $workgroup = '') {

  include samba::server::install
  include samba::server::config
  include samba::server::service

  $context = "/files/etc/samba/smb.conf"
  $target = "target[. = 'global']"

  augeas { 'global-section':
    context => $context,
    changes => "set ${target} global",
    require => Class["samba::server::config"],
    notify => Class['samba::server::service']
  }

  augeas { 'global-server_string':
    context => $context,
    changes => $server_string ? {
      default => "set \"${target}/server string\" '$server_string'",
      '' => "rm \"${target}/server string\"",
    },
    require => Augeas['global-section'],
    notify => Class['samba::server::service']
  }

  augeas { 'global-workgroup':
    context => $context,
    changes => $workgroup ? {
      default => "set ${target}/workgroup '$workgroup'",
      '' => "rm ${target}/workgroup",
    },
    require => Augeas['global-section'],
    notify => Class['samba::server::service']
  }
}