diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2016-03-24 14:18:03 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2016-03-24 14:18:03 -0300 |
commit | 309d5859d9c801218075789fe068869ab49065f5 (patch) | |
tree | dc31d7e0e39b48f75475f374d5301bba10c7c64a /manifests/server/share.pp | |
parent | 846ed365f19187b50f9aff0c7911b533880398a7 (diff) | |
parent | eb97a2b642499fde7afdb64dfd3e2b7e8c14eacc (diff) | |
download | puppet-samba-309d5859d9c801218075789fe068869ab49065f5.tar.gz puppet-samba-309d5859d9c801218075789fe068869ab49065f5.tar.bz2 |
Merge branch 'master' of https://github.com/ajjahn/puppet-samba
Conflicts:
manifests/server/service.pp
Diffstat (limited to 'manifests/server/share.pp')
-rwxr-xr-x[-rw-r--r--] | manifests/server/share.pp | 288 |
1 files changed, 137 insertions, 151 deletions
diff --git a/manifests/server/share.pp b/manifests/server/share.pp index b4eb02f..b0690bb 100644..100755 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -1,209 +1,195 @@ +# == Define samba::server::share +# define samba::server::share($ensure = present, + $available = '', $browsable = '', $comment = '', $copy = '', $create_mask = '', $directory_mask = '', $force_create_mask = '', - $force_directory_mask = '', + $force_directory_mode = '', $force_group = '', $force_user = '', - $guest_account = '', $guest_ok = '', $guest_only = '', + $hide_unreadable = '', $path = '', + $op_locks = '', + $level2_oplocks = '', + $veto_oplock_files = '', $read_only = '', $public = '', + $write_list = '', $writable = '', - $printable = '') { - + $printable = '', + $valid_users = '', + $follow_symlinks = '', + $wide_links = '', + $map_acl_inherit = '', + $store_dos_attributes = '', + $strict_allocate = '', + $hide_dot_files = '', + ) { + + $incl = $samba::server::incl $context = $samba::server::context - $target = "target[. = '${name}']" + $target = "target[. = '${name}']" + + $section_changes = $ensure ? { + present => "set ${target} '${name}'", + default => "rm ${target} '${name}'", + } augeas { "${name}-section": + incl => $incl, + lens => 'Samba.lns', context => $context, - changes => $ensure ? { - present => "set ${target} '${name}'", - default => "rm ${target} '${name}'", - }, + changes => $section_changes, require => Class['samba::server::config'], notify => Class['samba::server::service'] } if $ensure == 'present' { - augeas { "${name}-browsable": - context => $context, - changes => $browsable ? { - true => "set ${target}/browsable yes", - false => "set ${target}/browsable no", - default => "rm ${target}/browsable", - }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-comment": - context => $context, - changes => $comment ? { - default => "set ${target}/comment '${comment}'", - '' => "rm ${target}/comment", - }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-copy": - context => $context, - changes => $copy ? { - default => "set ${target}/copy '${copy}'", - '' => "rm ${target}/copy", - }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-create_mask": - context => $context, - changes => $create_mask ? { + $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}'", - '' => "rm \"${target}/create mask\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-directory_mask": - context => $context, - changes => $directory_mask ? { + $directory_mask ? { + '' => "rm \"${target}/directory mask\"", default => "set \"${target}/directory mask\" '${directory_mask}'", - '' => "rm \"${target}/directory mask\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-force_create_mask": - context => $context, - changes => $force_create_mask ? { + $force_create_mask ? { + '' => "rm \"${target}/force create mask\"", default => "set \"${target}/force create mask\" '${force_create_mask}'", - '' => "rm \"${target}/force create mask\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-force_directory_mask": - context => $context, - changes => $force_directory_mask ? { - default => "set \"${target}/force directory mask\" '${force_directory_mask}'", - '' => "rm \"${target}/force directory mask\"", + $force_directory_mode ? { + '' => "rm \"${target}/force directory mode\"", + default => "set \"${target}/force directory mode\" '${force_directory_mode}'", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-force_group": - context => $context, - changes => $force_group ? { + $force_group ? { + '' => "rm \"${target}/force group\"", default => "set \"${target}/force group\" '${force_group}'", - '' => "rm \"${target}/force group\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-force_user": - context => $context, - changes => $force_user ? { + $force_user ? { + '' => "rm \"${target}/force user\"", default => "set \"${target}/force user\" '${force_user}'", - '' => "rm \"${target}/force user\"", - }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-guest_account": - context => $context, - changes => $guest_account ? { - default => "set \"${target}/guest account\" '${guest_account}'", - '' => "rm \"${target}/guest account\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-guest_ok": - context => $context, - changes => $guest_ok ? { + $guest_ok ? { true => "set \"${target}/guest ok\" yes", false => "set \"${target}/guest ok\" no", - default => "rm \"${target}/guest ok\"", + default => "rm \"${target}/guest ok\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-guest_only": - context => $context, - changes => $guest_only ? { + $guest_only ? { true => "set \"${target}/guest only\" yes", false => "set \"${target}/guest only\" no", - default => "rm \"${target}/guest only\"", + default => "rm \"${target}/guest only\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-path": - context => $context, - changes => $path ? { + $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", + '' => "rm ${target}/path", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-read_only": - context => $context, - changes => $read_only ? { + $read_only ? { true => "set \"${target}/read only\" yes", false => "set \"${target}/read only\" no", - default => "rm \"${target}/read_only\"", + default => "rm \"${target}/read only\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-public": - context => $context, - changes => $public ? { + $public ? { true => "set \"${target}/public\" yes", false => "set \"${target}/public\" no", - default => "rm \"${target}/public\"", + default => "rm \"${target}/public\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-writable": - context => $context, - changes => $writable ? { + $writable ? { true => "set \"${target}/writable\" yes", false => "set \"${target}/writable\" no", - default => "rm \"${target}/writable\"", + default => "rm \"${target}/writable\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-printable": - context => $context, - changes => $printable ? { + $printable ? { true => "set \"${target}/printable\" yes", false => "set \"${target}/printable\" no", - default => "rm \"${target}/printable\"", + default => "rm \"${target}/printable\"", + }, + $follow_symlinks ? { + true => "set \"${target}/follow symlinks\" yes", + false => "set \"${target}/follow symlinks\" no", + default => "rm \"${target}/follow symlinks\"", }, + $wide_links ? { + true => "set \"${target}/wide links\" yes", + false => "set \"${target}/wide links\" no", + default => "rm \"${target}/wide links\"", + }, + $map_acl_inherit ? { + true => "set \"${target}/map acl inherit\" yes", + false => "set \"${target}/map acl inherit\" no", + default => "rm \"${target}/map acl inherit\"", + }, + $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\"", + }, + $valid_users ? { + '' => "rm \"${target}/valid users\"", + default => "set \"${target}/valid users\" '${valid_users}'", + }, + $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}'", + }, + $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\"", + }, + ] + + augeas { "${name}-changes": + incl => $incl, + lens => 'Samba.lns', + context => $context, + changes => $changes, require => Augeas["${name}-section"], notify => Class['samba::server::service'] } |