Defined Type: samba::server::share

Defined in:
manifests/server/share.pp

Overview

== Define samba::server::share

Parameters:

  • ensure (Any) (defaults to: present)
  • available (Any) (defaults to: '')
  • browsable (Any) (defaults to: '')
  • comment (Any) (defaults to: '')
  • copy (Any) (defaults to: '')
  • create_mask (Any) (defaults to: '')
  • directory_mask (Any) (defaults to: '')
  • force_create_mode (Any) (defaults to: '')
  • force_create_mask (Any) (defaults to: '')
  • force_directory_mode (Any) (defaults to: '')
  • force_group (Any) (defaults to: '')
  • force_user (Any) (defaults to: '')
  • guest_ok (Any) (defaults to: '')
  • guest_only (Any) (defaults to: '')
  • hide_unreadable (Any) (defaults to: '')
  • path (Any) (defaults to: '')
  • op_locks (Any) (defaults to: '')
  • level2_oplocks (Any) (defaults to: '')
  • veto_oplock_files (Any) (defaults to: '')
  • read_only (Any) (defaults to: '')
  • public (Any) (defaults to: '')
  • read_list (Any) (defaults to: '')
  • write_list (Any) (defaults to: '')
  • writable (Any) (defaults to: '')
  • printable (Any) (defaults to: '')
  • wide_links (Any) (defaults to: '')
  • follow_symlinks (Any) (defaults to: '')
  • valid_users (Any) (defaults to: '')
  • acl_group_control (Any) (defaults to: '')
  • map_acl_inherit (Any) (defaults to: '')
  • profile_acls (Any) (defaults to: '')
  • store_dos_attributes (Any) (defaults to: '')
  • strict_allocate (Any) (defaults to: '')
  • hide_dot_files (Any) (defaults to: '')
  • root_preexec (Any) (defaults to: '')
  • inherit_permissions (Any) (defaults to: '')
  • inherit_acls (Any) (defaults to: '')
  • delete_readonly (Any) (defaults to: '')
  • printer_name (Any) (defaults to: '')
  • msdfs_root (Any) (defaults to: '')
  • guest_account (Any) (defaults to: '')


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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'manifests/server/share.pp', line 3

define samba::server::share(
    $ensure               = present,
    $available            = '',
    $browsable            = '',
    $comment              = '',
    $copy                 = '',
    $create_mask          = '',
    $directory_mask       = '',
    $force_create_mode    = '',
    $force_create_mask    = '',
    $force_directory_mode = '',
    $force_group          = '',
    $force_user           = '',
    $guest_ok             = '',
    $guest_only           = '',
    $hide_unreadable      = '',
    $path                 = '',
    $op_locks             = '',
    $level2_oplocks       = '',
    $veto_oplock_files    = '',
    $read_only            = '',
    $public               = '',
    $read_list            = '',
    $write_list           = '',
    $writable             = '',
    $printable            = '',
    $wide_links           = '',
    $follow_symlinks      = '',
    $valid_users          = '',
    $acl_group_control    = '',
    $map_acl_inherit      = '',
    $profile_acls         = '',
    $store_dos_attributes = '',
    $strict_allocate      = '',
    $hide_dot_files       = '',
    $root_preexec         = '',
    $inherit_permissions  = '',
    $inherit_acls         = '',
    $delete_readonly      = '',
    $printer_name         = '',
    $msdfs_root           = '',
    $guest_account        = '',
) {

  include samba::server
  $config_file  = $samba::server::samba_config_file
  $context      = $samba::server::context
  $target       = "target[. = '${name}']"


  $section_changes = $ensure ? {
    present => "set ${target} '${name}'",
    default => "rm ${target} '${name}'",
  }

  augeas { "${name}-section":
    incl    => $config_file,
    lens    => 'Samba.lns',
    context => $context,
    changes => $section_changes,
    notify  => $samba::server::notify,
  }

  if $ensure == 'present' {
    $changes = [
      $available ? {
        true    => "set \"${target}/available\" yes",
        false   => "set \"${target}/available\" no",
        default => "rm  \"${target}/available\"",
      },
      $browsable ? {
        true    => "set \"${target}/browsable\" yes",
        false   => "set \"${target}/browsable\" no",
        default => "rm  \"${target}/browsable\"",
      },
      $comment ? {
        default => "set \"${target}/comment\" '${comment}'",
        ''      => "rm  \"${target}/comment\"",
      },
      $copy ? {
        ''      => "rm  \"${target}/copy\"",
        default => "set \"${target}/copy\" '${copy}'",
      },
      $create_mask ? {
        ''      => "rm  \"${target}/create mask\"",
        default => "set \"${target}/create mask\" '${create_mask}'",
      },
      $directory_mask ? {
        ''      => "rm  \"${target}/directory mask\"",
        default => "set \"${target}/directory mask\" '${directory_mask}'",
      },
      $force_create_mode ? {
        default => "set \"${target}/force create mode\" '${force_create_mode}'",
        ''      => "rm  \"${target}/force create mode\"",
      },
      $force_directory_mode ? {
        default => "set \"${target}/force directory mode\" '${force_directory_mode}'",
        ''      => "rm  \"${target}/force directory mode\"",
      },
      $force_create_mask ? {
        ''      => "rm  \"${target}/force create mask\"",
        default => "set \"${target}/force create mask\" '${force_create_mask}'",
      },
      $force_group ? {
        ''      => "rm  \"${target}/force group\"",
        default => "set \"${target}/force group\" '${force_group}'",
      },
      $force_user ? {
        ''      => "rm  \"${target}/force user\"",
        default => "set \"${target}/force user\" '${force_user}'",
      },
      $guest_ok ? {
        true    => "set \"${target}/guest ok\" yes",
        false   => "set \"${target}/guest ok\" no",
        default => "rm  \"${target}/guest ok\"",
      },
      $guest_only ? {
        true    => "set \"${target}/guest only\" yes",
        false   => "set \"${target}/guest only\" no",
        default => "rm  \"${target}/guest only\"",
      },
      $hide_unreadable ? {
        true    => "set \"${target}/hide unreadable\" yes",
        false   => "set \"${target}/hide unreadable\" no",
        default => "rm  \"${target}/hide unreadable\"",
      },
      $path ? {
        default => "set ${target}/path '${path}'",
        ''      => "rm  ${target}/path",
      },
      $read_only ? {
        true    => "set \"${target}/read only\" yes",
        false   => "set \"${target}/read only\" no",
        default => "rm  \"${target}/read only\"",
      },
      $public ? {
        true    => "set \"${target}/public\" yes",
        false   => "set \"${target}/public\" no",
        default => "rm  \"${target}/public\"",
      },
      $writable ? {
        true    => "set \"${target}/writable\" yes",
        false   => "set \"${target}/writable\" no",
        default => "rm  \"${target}/writable\"",
      },
      $printable ? {
        true    => "set \"${target}/printable\" yes",
        false   => "set \"${target}/printable\" no",
        default => "rm  \"${target}/printable\"",
      },
      $wide_links ? {
        true    => "set \"${target}/wide links\" yes",
        false   => "set \"${target}/wide links\" no",
        default => "rm  \"${target}/wide links\"",
      },
      $follow_symlinks ? {
        true    => "set \"${target}/follow symlinks\" yes",
        false   => "set \"${target}/follow symlinks\" no",
        default => "rm  \"${target}/follow symlinks\"",
      },
      $valid_users ? {
        default => "set \"${target}/valid users\" '${valid_users}'",
        ''      => "rm  \"${target}/valid users\"",
      },
      $acl_group_control ? {
        true    => "set \"${target}/acl group control\" yes",
        false   => "set \"${target}/acl group control\" no",
        default => "rm  \"${target}/acl group control\"",
      },
      $map_acl_inherit ? {
        true    => "set \"${target}/map acl inherit\" yes",
        false   => "set \"${target}/map acl inherit\" no",
        default => "rm  \"${target}/map acl inherit\"",
      },
      $profile_acls ? {
        true    => "set \"${target}/profile acls\" yes",
        false   => "set \"${target}/profile acls\" no",
        default => "rm  \"${target}/profile acls\"",
      },
      $store_dos_attributes ? {
        true    => "set \"${target}/store dos attributes\" yes",
        false   => "set \"${target}/store dos attributes\" no",
        default => "rm  \"${target}/store dos attributes\"",
      },
      $strict_allocate ? {
        true    => "set \"${target}/strict allocate\" yes",
        false   => "set \"${target}/strict allocate\" no",
        default => "rm  \"${target}/strict allocate\"",
      },
      $op_locks ? {
        ''      => "rm  \"${target}/oplocks\"",
        default => "set \"${target}/oplocks\" '${op_locks}'",
      },
      $level2_oplocks ? {
        ''      => "rm  \"${target}/level2 oplocks\"",
        default => "set \"${target}/level2 oplocks\" '${level2_oplocks}'",
      },
      $veto_oplock_files ? {
        ''      => "rm  \"${target}/veto oplock files\"",
        default => "set \"${target}/veto oplock files\" '${veto_oplock_files}'",
      },
      $read_list ? {
        ''      => "rm  \"${target}/read list\"",
        default => "set \"${target}/read list\" '${read_list}'",
      },
      $write_list ? {
        ''      => "rm  \"${target}/write list\"",
        default => "set \"${target}/write list\" '${write_list}'",
      },
      $hide_dot_files ? {
        true    => "set \"${target}/hide dot files\" yes",
        false   => "set \"${target}/hide dot files\" no",
        default => "rm  \"${target}/hide dot files\"",
      },
      $root_preexec ? {
        ''      => "rm  \"${target}/root preexec\"",
        default => "set \"${target}/root preexec\" '${root_preexec}'",
      },
      $inherit_permissions ? {
        true    => "set \"${target}/inherit permissions\" yes",
        false   => "set \"${target}/inherit permissions\" no",
        default => "rm  \"${target}/inherit permissions\"",
      },
      $inherit_acls ? {
        true    => "set \"${target}/inherit acls\" yes",
        false   => "set \"${target}/inherit acls\" no",
        default => "rm  \"${target}/inherit acls\"",
      },
      $delete_readonly ? {
        true    => "set \"${target}/delete readonly\" yes",
        false   => "set \"${target}/delete readonly\" no",
        default => "rm  \"${target}/delete readonly\"",
      },
      $printer_name ? {
        ''      => "rm  \"${target}/printer name\"",
        default => "set \"${target}/printer name\" '${printer_name}'",
      },
      $msdfs_root ? {
        true    => "set \"${target}/msdfs root\" yes",
        false   => "set \"${target}/msdfs root\" no",
        default => "rm  \"${target}/msdfs root\"",
      },
      $guest_account ? {
        ''      => "rm  \"${target}/guest account\"",
        default => "set \"${target}/guest account\" '${guest_account}'",
      },
    ]

    augeas { "${name}-changes":
      incl    => $config_file,
      lens    => 'Samba.lns',
      context => $context,
      changes => $changes,
      require => Augeas["${name}-section"],
      notify  => $samba::server::notify,
    }
  }
}