Commit c12cf0ee authored by Alex Tayts's avatar Alex Tayts
Browse files

initial commit

parents
.DS_Store
Tivoli Storage Manager agent
----------------------------
To use with default values, simply add the following in your manifest:
```
include tivoli_client
```
Default core config values are as follows:
```
tivoli_client::ensure: 'present'
tivoli_client::servername: 'bars10-data'
tivoli_client::tcpserveraddress: 'bars10-data'
tivoli_client::tcpport: '1500'
tivoli_client::domain: 'all-local'
tivoli_client::nodename: $hostname
tivoli_client::passwordaccess: 'generate'
tivoli_client::memoryef: 'no'
tivoli_client::encrypt: 'no'
```
As was the case before, there are a specific set of excludes added to inclexcl,
but the rest is up to you. Defaults for those parameters are as follows:
```
tivoli_client::xfiles: []
tivoli_client::xdirectories: []
tivoli_client::xfs: []
tivoli_client::ifiles: []
```
This revamp of the module eliminates the need for inheritance. If you don't
like the defaults values, simply override them in appropriate hiera data files.
#!/bin/sh
### BEGIN INIT INFO
# Provides: dsmc
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Tivoli backup scheduling daemon
# Description: Starts, stops, or restarts the Tivoli backup
# scheduling daemon. This daemon polls the backup
# servers periodically to determine the backup schedule
# and kicks off backups appropriately.
### END INIT INFO
# Author: Andrew May <amay@stanford.edu>
# Author: Russ Allbery <rra@stanford.edu>
PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="Tivoli scheduling daemon"
NAME=dsmc
DAEMON=/usr/bin/$NAME
SCRIPTNAME=/etc/init.d/$NAME
# Gracefully exit if the package has been removed.
[ -x $DAEMON ] || exit 0
# Define LSB log functions (requires lsb-base >= 3.0-6).
. /lib/lsb/init-functions
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
do_start()
{
start-stop-daemon --background --start --quiet --exec $DAEMON \
--test > /dev/null || return 1
start-stop-daemon --background --start --quiet --exec $DAEMON \
-- sched || return 2
}
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
do_stop()
{
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --exec $DAEMON
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
*) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
*)
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
:
#!/bin/sh
# $Id: init.dsmc.RedHat 6026 2008-03-11 17:25:47Z darrenp1 $
#
# dsmc This shell script takes care of starting and stopping
# the ADSM/TSM scheduler
#
# chkconfig: 2345 90 40
# description: ADSM/TSM scheduled backup daemon
# Source function library.
. /etc/init.d/functions
TSMBIN="/opt/tivoli/tsm/client/ba/bin/dsmc"
start () {
echo -n "Starting dsmc scheduler:"
pids="`/sbin/pidof $TSMBIN`"
if [ ! -d /var/log/backup ]; then
mkdir /var/log/backup
fi
if [ -z "$pids" ] ; then
nohup $TSMBIN sched >/dev/null 2>/var/log/backup/dsmerror &
RETVAL=$?
else
RETVAL=1
echo -n " ... already running."
fi
if [ "$RETVAL" == "0" ]; then
success
else
failure
fi
echo
return $RETVAL
}
stop () {
#killproc ntpd
echo -n $"Shutting down dsmc: "
pkill -U root -f $TSMBIN
RETVAL=$?
if [ "$RETVAL" == "0" ]; then
success
else
failure
fi
echo
return $RETVAL
}
case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
restart)
stop
sleep 2
start
RETVAL=$?
;;
status)
status $TSMBIN
RETVAL=$?
;;
*)
echo "Usage: $0 [start|stop|status|restart]"
exit 1
;;
esac
#!/bin/sh
### BEGIN INIT INFO
# Provides: dsmcad
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: DSMCAD initscript
# Description: This script replaces the /etc/init.d/dsmcad script
# from IBM that only works on Red Hat variants
# to start the dmscad service on Debian variants
### END INIT INFO
# Author: Gabriel Paues <gabriel.paues@safespring.com>
#
DESC="DSMCAD Start Script"
DSMCAD_DIR=/opt/tivoli/tsm/client/ba/bin
DAEMON=$DSMCAD_DIR/dsmcad
PIDFILE=/var/run/dsmcad.pid
WORKING_DIR=/var/log/tsm
mkdir -p $WORKING_DIR
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting dsmcad" "dsmcad"
cd $WORKING_DIR
start_daemon -p $PIDFILE $DAEMON
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping dsmcad" "dsmcad"
killproc -p $PIDFILE $DAEMON
log_end_msg $?
;;
force-reload|restart)
$0 stop
$0 start
;;
status)
status_of_proc -p $PIDFILE $DAEMON atd && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/dsmcad {start|stop|restart|force-reload|status}"
exit 1
;;
esac
EOF
#!/bin/sh
#
# chkconfig: - 91 35
# description: Starts and stops TSM client acceptor daemon
#
#Source function library.
. /etc/rc.d/init.d/functions
[ -f /opt/tivoli/tsm/client/ba/bin/dsmc ] || exit 0
[ -f /opt/tivoli/tsm/client/ba/bin/dsmcad ] || exit 0
prog="dsmcad"
export DSM_DIR=/opt/tivoli/tsm/client/ba/bin
export DSM_CONFIG=/opt/tivoli/tsm/client/ba/bin/dsm.opt
start() {
echo -n $"Starting $prog: "
cd $DSM_DIR
daemon $DSM_DIR/dsmcad
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dsmcad
return $RETVAL
}
stop() {
if test "x`pidof dsmcad`" != x; then
echo -n $"Stopping $prog: "
killproc dsmcad
echo
fi
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dsmcad
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status dsmcad
;;
restart)
stop
start
;;
condrestart)
if test "x`pidof dsmcad`" != "x"; then
stop
start
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit 0
exclude /.../core
exclude.dir /.../tmp
exclude /var/cache
exclude.fs /var/cache
exclude.dir /var/cache
exclude /usr/vice/cache
exclude.fs /usr/vice/cache
exclude.dir /usr/vice/cache
exclude /tmp
exclude.fs /tmp
exclude /etc/krb5.keytab
exclude /etc/srvtab
exclude /.../oradata/.../*.dbf
exclude /.../oradata/.../redo*.log
exclude /.../oradata/.../control*.ctl
exclude.dir /*/oradata
exclude /.../*.dbf
exclude /opt/patrol/.../log/history/.../*
exclude /opt/*datatools/.../log/.../*
exclude /u01/.../DBA_TOOL/logs/*
exclude /u01/.../APPL_TOOL/logs/*
exclude /u01/.../ADMIN_TOOL/logs/*
exclude /u01/app/oracle/admin/.../adump/*
exclude /u01/app/oracle/admin/.../bdump/*
exclude /u01/app/oracle/admin/.../cdump/*
exclude /u01/app/oracle/admin/.../udump/*
exclude /.../oracle/.../*.trc
exclude /.../oracle/.../*.aud
exclude /.../dsmsched.log
exclude /.../dsmerror
exclude /.../dsmerror.log
# Set up a Tivoli backup client.
class tivoli_client (
# push or pull the configs and packages
$ensure = 'present',
# BaRS server
$servername = 'bars10-data',
# BaRS server (can be identical to servername, or the IP)
$tcpserveraddress = 'bars10-data',
# BaRS server port
$tcpport = '1500',
# node name, as registered with BaRS
$nodename = $::hostname,
# Wide inclusion net; seldom do you want to stray from all-local
$domain = 'all-local',
# Password caching option. generate = encrypt and stow password locally.
# prompt = prompt for password every time you connect to the server
$passwordaccess = 'generate',
# Efficiency setting. no = consume all the resources it wants.
# yes = less memory, Diskcachememory = less memory but uses more disk space
$memoryef = 'no',
# whether to encrypt backups to the server
$encrypt = 'no',
# Note that for the below, if provided, these will prepend baseline inclexcl
$xfiles = [], # additional files to exclude
$xdirectories = [], # additional directories to exclude
$xfs = [], # additional filesystems to exclude
$ifiles = []) # files to explicitly include
{
# default path for all execs
Exec {
path => '/bin:/usr/bin:/sbin:/usr/sbin',
}
#############################################################################
# Package installation and tweaks
#############################################################################
include packages::compatlibs
include packages::libstdc
file { '/etc/tivoli':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
}
$service_name = 'dsmc'
# usual service state wrapper
case $ensure {
'present': {
$service_ensure = 'running'
$service_enable = true
}
'absent': {
$service_ensure = 'stopped'
$service_enable = false
}
}
case $::osfamily {
# RedHat-specific
'RedHat': {
$tivlib='/opt/tivoli/tsm/client/api/bin64'
$tivbin='/opt/tivoli/tsm/client/ba/bin'
$tivba='TIVsm-BA'
package { $tivba:
ensure => $ensure,
require => [Package['libstdc++'], File['/etc/tivoli']],
}
# soft link binaries and libs since the pkg install is inconsistent
file {
# binaries
'/usr/bin/dsmadmc':
ensure => link,
target => "${tivbin}/dsmadmc",
require => Package[$tivba];
'/usr/bin/dsmagent':
ensure => link,
target => "${tivbin}/dsmagent",
require => Package[$tivba];
'/usr/bin/dsmc':
ensure => link,
target => "${tivbin}/dsmc",
require => Package[$tivba];
'/usr/bin/dsmcad':
ensure => link,
target => "${tivbin}/dsmcad",
require => Package[$tivba];
'/usr/bin/dsmj':
ensure => link,
target => "${tivbin}/dsmj",
require => Package[$tivba];
'/usr/bin/dsmswitch':
ensure => link,
target => "${tivbin}/dsmswitch",
require => Package[$tivba];
'/usr/bin/dsmtca':
ensure => link,
target => "${tivbin}/dsmtca",
require => Package[$tivba];
# libs
'/usr/lib/libApiDS.so':
ensure => link,
target => "${tivlib}/libApiDS.so",
require => Package[$tivba];
'/usr/lib/libct_cu.so':
ensure => link,
target => "${tivlib}/libct_cu.so",
require => Package[$tivba];
'/usr/lib/libdmapi.so':
ensure => link,
target => "${tivlib}/libdmapi.so",
require => Package[$tivba];
'/usr/lib/libgpfs.so':
ensure => link,
target => "${tivlib}/libgpfs.so",
require => Package[$tivba];
'/usr/lib/libha_gs_r.so':
ensure => link,
target => "${tivlib}tivlib/libha_gs_r.so",
require => Package[$tivba];
}
}
# Debian-specific
'Debian': {
$tivba='tivsm-ba'
$tivlib='/opt/tivoli/tsm/client/api/bin64'
package { $tivba:
ensure => $ensure,
require => File['/etc/tivoli'],
}
}
# Not EL or Debian? do nothing
default: {
}
}
# symlinks for all OS'
file {
'/opt/tivoli/tsm/client/ba/bin/dsm.sys':
ensure => link,
target => '/etc/tivoli/dsm.sys',
require => [ Package[$tivba] ];
'/opt/tivoli/tsm/client/ba/bin/dsm.opt':
ensure => link,
target => '/etc/tivoli/dsm.opt',
require => [ Package[$tivba] ];
'/opt/tivoli/tsm/client/ba/bin/inclexcl':
ensure => link,
target => '/etc/tivoli/inclexcl',
require => [ Package[$tivba] ];
# This is required for RMAN backups. Add dsm.sys under api.
"${tivlib}/dsm.sys":
ensure => link,
target => '/etc/tivoli/dsm.sys',
require => [ Package[$tivba] ],
}
# TEMPORARY. Remove the old erroneous dsmc init script.
file { '/etc/init.d/dsmc': ensure => 'absent', }
if $::service_provider == 'systemd' {
# create systemd unit for OSes running it
systemd::service { $service_name:
ensure => $ensure,
description => 'TSM Scheduler',
after => 'network.target',
execstart => '/opt/tivoli/tsm/client/ba/bin/dsmc sched',
working_directory => '/opt/tivoli/tsm/client/ba/bin',
remain_after_exit => true,
restart => 'on-failure',
env_vars => [ 'LANG=en_US', 'LC_ALL=en_US' ],
wantedby => [ 'multi-user.target' ],
require => Package[$tivba],
}
# run the service
service { $service_name:
ensure => $service_ensure,
enable => $service_enable,
require => Systemd::Service[$service_name],
}
} else {
# Install the init script for systemv OSes
file { '/etc/init.d/dsmc':
ensure => $ensure,
source => "puppet:///modules/tivoli_client/etc/init.d/dsmc.${::osfamily}",
owner => 'root',
group => 'root',
mode => '0755',
}
service { $service_name:
ensure => $service_ensure,
enable => $service_enable,
hasstatus => true,
require => File['/etc/init.d/dsmcad'],
}
}
#############################################################################
# Templated config files
#############################################################################
file {
'/etc/tivoli/dsm.opt':
ensure => $ensure,
content => template('tivoli_client/etc/tivoli/dsm.opt.erb'),
owner => 'root',
group => 'root',
mode => '0644',
require => File['/etc/tivoli'],
notify => Service[$service_name];
'/etc/tivoli/dsm.sys':
ensure => $ensure,
content => template('tivoli_client/etc/tivoli/dsm.sys.erb'),
owner => 'root',
group => 'root',
mode => '0644',
require => File['/etc/tivoli'],
notify => Service[$service_name];
'/etc/tivoli/inclexcl':
ensure => $ensure,
content => template('tivoli_client/etc/tivoli/inclexcl.erb'),
owner => 'root',
group => 'root',
mode => '0644',
require => File['/etc/tivoli'],
notify => Service[$service_name];
}
}
* $Id: dsm.sys.erb 9038 2008-06-20 03:53:59Z rra $
Servername <%= @servername %>
nodename <%= @nodename %>
commmethod TCPip
tcpport <%= @tcpport %>
tcpserveraddress <%= @tcpserveraddress %>.stanford.edu
tcpb 32
tcpnodelay yes
tcpwindowsize 16
txnbytelimit 25600
<% if (@memoryef == "yes") then -%>
memoryefficientbackup yes
<% end -%>