Puppet Class: samba::server

Defined in:
manifests/server.pp

Overview

== Class samba::server

Parameters:

  • interfaces (Any) (defaults to: false)
  • security (Any) (defaults to: false)
  • server_string (Any) (defaults to: false)
  • unix_password_sync (Any) (defaults to: false)
  • bind_interfaces_only (Any) (defaults to: 'yes')
  • realm (Any) (defaults to: false)
  • machine_password_timeout (Any) (defaults to: false)
  • unix_extensions (Any) (defaults to: 'no')
  • netbios_name (Any) (defaults to: false)
  • workgroup (Any) (defaults to: false)
  • socket_options (Any) (defaults to: false)
  • deadtime (Any) (defaults to: false)
  • keepalive (Any) (defaults to: false)
  • load_printers (Any) (defaults to: false)
  • printing (Any) (defaults to: false)
  • printcap_name (Any) (defaults to: false)
  • map_to_guest (Any) (defaults to: 'Never')
  • guest_account (Any) (defaults to: 'nobody')
  • disable_spoolss (Any) (defaults to: false)
  • kernel_oplocks (Any) (defaults to: false)
  • pam_password_change (Any) (defaults to: false)
  • os_level (Any) (defaults to: false)
  • preferred_master (Any) (defaults to: false)
  • shares (Any) (defaults to: {})
  • users (Any) (defaults to: {})
  • restrict_anonymous (Any) (defaults to: 1)
  • manage_package (Any) (defaults to: true)
  • manage_service (Any) (defaults to: true)
  • service_enable (Any) (defaults to: true)
  • service_ensure (Any) (defaults to: 'running')


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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'manifests/server.pp', line 3

class samba::server(
    $interfaces               = false,
    $security                 = false,
    $server_string            = false,
    $unix_password_sync       = false,
    $bind_interfaces_only     = 'yes',
    $realm                    = false,
    $machine_password_timeout = false,
    $unix_extensions          = 'no',
    $netbios_name             = false,
    $workgroup                = false,
    $socket_options           = false,
    $deadtime                 = false,
    $keepalive                = false,
    $load_printers            = false,
    $printing                 = false,
    $printcap_name            = false,
    $map_to_guest             = 'Never',
    $guest_account            = 'nobody',
    $disable_spoolss          = false,
    $kernel_oplocks           = false,
    $pam_password_change      = false,
    $os_level                 = false,
    $preferred_master         = false,
    $shares                   = {},
    $users                    = {},
    $restrict_anonymous       = 1,

    $manage_package           = true,
    $manage_service           = true,
    $service_enable           = true,
    $service_ensure           = 'running',

) {

  include samba::params
  $samba_config_dir   = $samba::params::samba_config_dir
  $samba_config_file  = $samba::params::samba_config_file
  $context            = "/files${samba_config_file}"
  $target             = 'target[. = "global"]'
  $services           = $samba::params::services

  $notify = $manage_service ? {
    true  => Service[$services],
    false => undef,
  }

  if $manage_package {
    ensure_packages('samba', {ensure => installed})
  }

  file { $samba_config_dir:
    ensure => directory,
    owner  => 'root',
    group  => 'root',
    mode   => '0755',
  }

  file { $samba_config_file:
    ensure => file,
    owner  => 'root',
    group  => 'root',
    mode   => '0644',
  }

  if $manage_service {
    $services.each |$service| {
      service { $service :
        ensure    => $service_ensure,
        enable    => $service_enable,
        subscribe => File[$samba_config_file],
      }
    }
  }



  augeas { 'global-section':
    incl    => $samba_config_file,
    lens    => 'Samba.lns',
    context => $context,
    changes => "set ${target} global",
    require => File[$samba_config_file],
    notify  => Service[$samba::params::services],
  }


  samba::server::option {"realm=${realm}": }
  samba::server::option {"machine password timeout=${machine_password_timeout}": }
  samba::server::option {"unix extensions=${unix_extensions}": }
  samba::server::option {"interfaces=${interfaces}": }
  samba::server::option {"bind interfaces only=${bind_interfaces_only}": }
  samba::server::option {"security=${security}": }
  samba::server::option {"server string=${server_string}": }
  samba::server::option {"unix password sync=${unix_password_sync}": }
  samba::server::option {"netbios name=${netbios_name}": }
  samba::server::option {"workgroup=${workgroup}": }
  samba::server::option {"socket options=${socket_options}": }
  samba::server::option {"deadtime=${deadtime}": }
  samba::server::option {"keepalive=${keepalive}": }
  samba::server::option {"load printers=${load_printers}": }
  samba::server::option {"printing=${printing}": }
  samba::server::option {"printcap name=${printcap_name}": }
  samba::server::option {"map to guest=${map_to_guest}": }
  samba::server::option {"guest account=${guest_account}": }
  samba::server::option {"disable spoolss=${disable_spoolss}": }
  samba::server::option {"kernel oplocks=${kernel_oplocks}": }
  samba::server::option {"pam password change=${pam_password_change}": }
  samba::server::option {"os level=${os_level}": }
  samba::server::option {"preferred master=${preferred_master}": }
  samba::server::option {"restrict anonymous=${restrict_anonymous}": }

  create_resources(samba::server::share, $shares)
  create_resources(samba::server::user, $users)
}