diff --git a/samba/manifests/init.pp b/samba/manifests/init.pp index 1647906..9a192a1 100644 --- a/samba/manifests/init.pp +++ b/samba/manifests/init.pp @@ -6,12 +6,35 @@ class samba::server { ensure => installed, } - service { "smb": - ensure => running, - enable => true, - hasstatus => true, - hasrestart => true, - require => File["/etc/samba/smb.conf"], + case $operatingsystem { + openbsd: { + service { "nmbd": + ensure => running, + enable => true, + binary => "/usr/local/libexec/nmbd", + start => "/usr/local/libexec/nmbd -D", + require => File["/etc/samba/smb.conf"], + subscribe => File["/etc/samba/smb.conf"], + } + service { "smbd": + ensure => running, + enable => true, + binary => "/usr/local/libexec/smbd", + start => "/usr/local/libexec/smbd -D", + require => File["/etc/samba/smb.conf"], + subscribe => File["/etc/samba/smb.conf"], + } + } + default: { + service { "smb": + ensure => running, + enable => true, + hasstatus => true, + hasrestart => true, + require => File["/etc/samba/smb.conf"], + subscribe => File["/etc/samba/smb.conf"], + } + } } file { "/etc/samba/smb.conf": @@ -20,9 +43,11 @@ class samba::server { "puppet:///files/samba/smb.conf", ], mode => 0644, owner => root, - group => root, + group => $operatingsystem ? { + openbsd => wheel, + default => root, + }, require => Package["samba"], - notify => Service["smb"], } file { "/etc/samba/lmhosts": @@ -32,7 +57,10 @@ class samba::server { "puppet:///samba/lmhosts", ], mode => 0644, owner => root, - group => root, + group => $operatingsystem ? { + openbsd => wheel, + default => root, + }, require => Package["samba"], } @@ -54,10 +82,11 @@ class samba::domainmember { include samba::server exec { "net join": - command => "net join -U ${samba_join_user}%'${samba_join_pass}'", - path => "/bin:/usr/bin:/sbin:/usr/sbin", - onlyif => "rpcclient localhost -c 'srvinfo' -U root%'' 2>&1 | grep 'NT_STATUS_CANT_ACCESS_DOMAIN_INFO'", - require => Service["smb"], + command => "net join -U ${samba_join_user}%'${samba_join_pass}'", + path => "/bin:/usr/bin:/sbin:/usr/sbin", + onlyif => "rpcclient localhost -c 'srvinfo' -U root%'' 2>&1 | grep 'NT_STATUS_CANT_ACCESS_DOMAIN_INFO'", + require => [ Package["samba"], + File["/etc/samba/smb.conf"], ], } }