From de5f1955b4740a7521e5b60f0789022bdd3ae4ad Mon Sep 17 00:00:00 2001 From: Ossi Salmi Date: Thu, 30 Oct 2014 11:11:46 +0200 Subject: [PATCH] samba: Add support for local server configuration --- samba/manifests/init.pp | 28 ++++++++++++++++++++++++---- samba/templates/smb.conf.erb | 3 +++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/samba/manifests/init.pp b/samba/manifests/init.pp index 105aa1c..5d1ecff 100644 --- a/samba/manifests/init.pp +++ b/samba/manifests/init.pp @@ -80,6 +80,8 @@ class samba::server::configs { # $workgroup: # Workgroup or domain name. For ad authentication this needs to be # full ad realm name. +# $localconf: +# Source of optional local configuration. # # === Global variables # @@ -98,10 +100,14 @@ class samba::server::configs { # Password to use when joining to domain. Only used when $auth is # set to domain. # -class samba::server($names=[$::hostname], $auth="tdbsam", - $workgroup="WORKGROUP", - $description="Samba Server Version %v", - $interfaces=undef) { +class samba::server( + $names=[$::hostname], + $auth="tdbsam", + $workgroup="WORKGROUP", + $description="Samba Server Version %v", + $interfaces=undef, + $localconf=undef, +) { include samba::server::configs @@ -150,6 +156,20 @@ class samba::server($names=[$::hostname], $auth="tdbsam", }, } + if $localconf { + file { "/etc/samba/smb.conf.d/local.conf": + ensure => present, + mode => "0644", + owner => "root", + group => $::operatingsystem ? { + "openbsd" => "wheel", + default => "root", + }, + source => $localconf, + notify => Service["smb"], + } + } + file { "/etc/samba/lmhosts": ensure => present, source => [ "puppet:///files/samba/lmhosts.${::homename}", diff --git a/samba/templates/smb.conf.erb b/samba/templates/smb.conf.erb index f11c5b7..567e635 100644 --- a/samba/templates/smb.conf.erb +++ b/samba/templates/smb.conf.erb @@ -51,5 +51,8 @@ wide links = no include = /etc/samba/smb.conf.d/domain.conf include = /etc/samba/smb.conf.d/print.conf include = /etc/samba/smb.conf.d/wins.conf +<% if @localconf -%> +include = /etc/samba/smb.conf.d/local.conf +<% end -%> include = /etc/samba/smb.conf.d/shares.conf