Added BDC support scripts to samba module.
This commit is contained in:
parent
2dbaf3f632
commit
13d05c52ac
2 changed files with 62 additions and 0 deletions
45
samba/files/sync-netlogon.sh
Executable file
45
samba/files/sync-netlogon.sh
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# check that domain controller is alive
|
||||||
|
smbclient -N -L pdc > /dev/null 2>&1
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Error in netlogon sync, could not open connection to DC"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# get target directory
|
||||||
|
TARGETDIR="`echo '' | testparm --section-name netlogon 2> /dev/null | \
|
||||||
|
sed -n 's/^[ \t]*path[ ]*=[ ]*\(.*\)$/\1/p'`"
|
||||||
|
if [ "${TARGETDIR}" = "" ]; then
|
||||||
|
echo "Error in netlogon sync, failed to determine netlogon directory"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ ! -d "${TARGETDIR}" ]; then
|
||||||
|
echo "Error in netlogon sync, netlogon directory does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# create temporary working directory
|
||||||
|
TMPDIR=/tmp/netlogon.$$
|
||||||
|
if [ -d ${TMPDIR} ]; then
|
||||||
|
echo "Temporary directory ${TMPDIR} already exists."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
mkdir ${TMPDIR}
|
||||||
|
|
||||||
|
# copy netlogon data from domain controller
|
||||||
|
( smbclient //pdc/netlogon -N -Tqc - | (cd ${TMPDIR} ; tar xf - ) ) \
|
||||||
|
>> /var/log/samba/log.sync-netlogon 2>&1
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Error in netlogon sync see /var/log/samba/log.sync-netlogon"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rsync -a --delete ${TMPDIR}/ ${TARGETDIR}/
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Error in netlogon sync, rsync failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
chcon -Rh -u system_u -t samba_share_t ${TARGETDIR}/
|
||||||
|
|
||||||
|
rm -rf ${TMPDIR}
|
|
@ -67,6 +67,23 @@ class samba::server {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Install support scripts for Backup Domain Controller
|
||||||
|
#
|
||||||
|
class samba::bdc {
|
||||||
|
|
||||||
|
include samba::server
|
||||||
|
|
||||||
|
file { "/etc/cron.hourly/sync-netlogon.sh":
|
||||||
|
ensure => present,
|
||||||
|
source => "puppet:///samba/sync-netlogon.sh",
|
||||||
|
mode => 0755,
|
||||||
|
owner => root,
|
||||||
|
group => root,
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Join samba server into domain.
|
# Join samba server into domain.
|
||||||
#
|
#
|
||||||
# === Global variables
|
# === Global variables
|
||||||
|
|
Loading…
Add table
Reference in a new issue