From 3a31e6508643ef4d09c96c9ffaefae433a36992e Mon Sep 17 00:00:00 2001 From: Thomas Bellman <bellman@nsc.liu.se> Date: Thu, 12 Jan 2012 17:00:00 +0100 Subject: [PATCH] Make it possible to declare multiple TSM servers. This change makes it possible to have multiple tsmclient declarations, each generating its own section in dsm.sys and dsm.opt, and each having its own include/exclude list. --- manifests/init.pp | 39 ++++++++++++++++++++++++++------------- templates/dsm.opt.erb | 2 +- templates/dsm.sys.erb | 4 ++-- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 1998ae9..bd8497e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -38,8 +38,12 @@ import "nsc-puppet-utils" /* * Configure node to be a TSM client. * - * It is currently forbidden to use this define more than once for - * a node, even if you use different names. + * It is allowed to use this definition multiple times (with different + * names), in which case dsm.sys and dsm.opt will contain all the + * declared servers with their respective configurations. Unconfiguring + * a server is done by just not declaring it in the manifests anymore. + * There is however no way of declaring which of the servers should be + * the default server. * * The caller must provide a class named 'tsmclient::siteconfig' * for configuration, defining the following class variables: @@ -193,22 +197,18 @@ define tsmclient($serveraddress, $nodename=$fqdn, } file { - "${tsmdir}/bin/dsm.opt": - ensure => file, - content => template('tsmclient/dsm.opt.erb'), - owner => 'root', group => 'root', mode => 0444, - require => Package['TIVsm-BA'], notify => Service['dsmcad']; - "${tsmdir}/bin/dsm.sys": - ensure => file, - content => template('tsmclient/dsm.sys.erb'), - owner => 'root', group => 'root', mode => 0444, - require => Package['TIVsm-BA'], notify => Service['dsmcad']; - "${tsmdir}/bin/include_exclude": + "${tsmdir}/bin/include_exclude.${tsm_servername}": ensure => file, content => template('tsmclient/include_exclude.erb'), owner => 'root', group => 'root', mode => 0444, require => Package['TIVsm-BA'], notify => Service['dsmcad']; } + concat_part { + "${tsmdir}/bin/dsm.opt/${tsm_servername}": + content => template('tsmclient/dsm.opt.erb'); + "${tsmdir}/bin/dsm.sys/${tsm_servername}": + content => template('tsmclient/dsm.sys.erb'); + } } @@ -302,6 +302,7 @@ class tsmclient::install include tsmclient::vars include tsmclient::siteconfig + $tsmdir = $tsmclient::vars::tsmdir $tsmpassworddir = $tsmclient::vars::tsmpassworddir package { @@ -332,6 +333,18 @@ class tsmclient::install owner => 'root', group => 'root', mode => 0644, require => Package['TIVsm-BA'], notify => Service['dsmcad']; + # Remnants from older versions of the tsmclient definition + "${tsmdir}/bin/include_exclude": + ensure => absent; + + } + concat_file { + "${tsmdir}/bin/dsm.opt": + owner => 'root', group => 'root', mode => 0444, + require => Package['TIVsm-BA'], notify => Service['dsmcad']; + "${tsmdir}/bin/dsm.sys": + owner => 'root', group => 'root', mode => 0444, + require => Package['TIVsm-BA'], notify => Service['dsmcad']; } # Manage password file diff --git a/templates/dsm.opt.erb b/templates/dsm.opt.erb index eea0888..38f0b0e 100644 --- a/templates/dsm.opt.erb +++ b/templates/dsm.opt.erb @@ -25,4 +25,4 @@ options.merge!(mandatory) SERVERNAME <%= tsm_servername.upcase %> <% options.keys.sort.each do |optname| -%> <%= sprintf("%-24s %s", optname.to_s, options[optname]).strip %> -<% end -%> +<% end %> diff --git a/templates/dsm.sys.erb b/templates/dsm.sys.erb index cbe5199..ec61a59 100644 --- a/templates/dsm.sys.erb +++ b/templates/dsm.sys.erb @@ -8,7 +8,7 @@ mandatory = { 'commmethod' => "tcpip", 'tcpserveraddress' => tsm_serveraddress, 'passworddir' => "#{tsmpassworddir}/", - 'inclexcl' => "#{tsmdir}/bin/include_exclude", + 'inclexcl' => "#{tsmdir}/bin/include_exclude.#{tsm_servername}", } options = { } @@ -31,4 +31,4 @@ SERVERNAME <%= tsm_servername.upcase %> NODENAME <%= tsm_nodename %> <% options.keys.sort.each do |optname| -%> <%= sprintf("%-24s %s", optname.to_s, options[optname]).strip %> -<% end -%> +<% end %> -- GitLab