samba: Add support for local server configuration

This commit is contained in:
Ossi Salmi 2014-10-30 11:11:46 +02:00
parent 2831f5ae05
commit de5f1955b4
2 changed files with 27 additions and 4 deletions

View file

@ -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}",

View file

@ -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