diff --git a/manifests/init.pp b/manifests/init.pp index e8950ff..e3eae68 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -4,22 +4,67 @@ # # === Parameters # -# Document parameters here. +# [*server_name*] +# server_name - optional, server id in the config file # -# [*sample_parameter*] -# Explanation of what this parameter affects and what it defaults to. -# e.g. "Specify one or more upstream ntp servers as an array." +# [*comm_method*] +# comm_method - optional # -# === Variables +# [*tcp_port*] +# tcp_port - optional # -# Here you should define a list of variables that this module would require. +# [*package_ensure*] +# package_ensure - optional +# +# [*packages*] +# packages - optional +# +# [*package_adminfile*] +# package_adminfile - optional +# +# [*package_uri*] +# package_uri - optional +# +# [*service_manage*] +# service_manage - optional +# +# [*service_name*] +# service_name - optional +# +# [*service_manifest*] +# service_manifest - optional +# +# [*service_manifest_source*] +# service_manifest_source - optional +# +# [*service_script*] +# service_script - optional +# +# [*service_script_source*] +# service_script_source - optional +# +# [*config*] +# config - optional +# +# [*config_replace*] +# config_replace - optional +# +# [*config_template*] +# config_template - optional +# +# [*inclexcl*] +# inclexcl - optional +# +# [*inclexcl_source*] +# inclexcl_source - optional +# +# [*config_hash*] +# config_hash - hash with extended parameters +# keys => value +# +# [*tcp_server_address*] +# tcp_server_address - obligatory # -# [*sample_variable*] -# Explanation of how this variable affects the funtion of this class and if it -# has a default. e.g. "The parameter enc_ntp_servers must be set by the -# External Node Classifier as a comma separated list of hostnames." (Note, -# global variables should not be used in preference to class parameters as of -# Puppet 2.6.) # # === Examples # @@ -35,9 +80,10 @@ # Copyright 2011 Your name here, unless otherwise noted. # class tsm ( + $server_name = $name, + $comm_method = $::tsm::params::comm_method, + $tcp_port = $::tsm::params::tcp_port, $package_ensure = $::tsm::params::package_ensure, - $tsm_host = $::tsm::params::tsm_host, - $tsm_port = $::tsm::params::tsm_port, $packages = $::tsm::params::packages, $package_adminfile = $::tsm::params::package_adminfile, $package_uri = $::tsm::params::package_uri, @@ -53,11 +99,15 @@ $inclexcl = $::tsm::params::inclexcl, $inclexcl_replace = $::tsm::params::inclexcl_replace, $inclexcl_source = $::tsm::params::inclexcl_source, + $config_hash = {}, + $tcp_server_address, + ) inherits tsm::params { validate_string($package_ensure) - validate_string($tsm_host) - validate_string($tsm_port) + validate_string($tcp_server_address) + validate_string($tcp_port) + validate_string($comm_method) validate_array($packages) validate_string($package_uri) validate_bool($service_manage) @@ -76,6 +126,9 @@ validate_absolute_path($package_adminfile) validate_absolute_path($service_manifest) } + default: { + # do nothing + } } anchor {'tsm::begin': } -> diff --git a/manifests/params.pp b/manifests/params.pp index 64e85b9..5cd0613 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -110,8 +110,9 @@ $service_ensure = 'running' $service_enable = true - $tsm_host = 'unknown' - $tsm_port = 'unknown' + # default parameters fot dsm.sys + $comm_method = 'TCPip' + $tcp_port = '1500' $config = '/opt/tivoli/tsm/client/ba/bin/dsm.sys' $config_template = 'tsm/dsm.sys.erb' @@ -132,7 +133,7 @@ case $::hardwareisa { i386: { $packages = ['gsk8cry32','gsk8cry64','gsk8ssl32','gsk8ssl64','TIVsmCapi', 'TIVsmCba'] - $package_uri = "http://server/pkgs/solaris/${::hardwareisa}/5.10" + $package_uri = "http://sunkist6.eb.lan.at/pkgs/solaris/${::hardwareisa}/5.10" $package_adminfile = '/var/sadm/install/admin/puppet' $service_name = 'tsm' $service_manifest = '/var/svc/manifest/site/tsmsched.xml' @@ -153,7 +154,7 @@ $inclexcl_source = 'puppet:///modules/tsm/InclExcl.solaris' } default:{ - fail("Unsupported hardwareisa ${::hardwareisa} for osfamily ${::osfamily} in config.pp!") + fail("Unsupported kernelrelease ${::kernelrelease} for osfamily ${::osfamily} in config.pp!") } } } diff --git a/spec/classes/tsm_spec.rb b/spec/classes/tsm_spec.rb index c124932..a786ed5 100644 --- a/spec/classes/tsm_spec.rb +++ b/spec/classes/tsm_spec.rb @@ -12,6 +12,10 @@ } end + let(:params) {{ + :tcp_server_address => 'tsm', + }} + it { should contain_class('tsm::install') } it { should contain_class('tsm::config') } it { should contain_class('tsm::service') } @@ -26,25 +30,37 @@ } end - it { should contain_tsm__installpkg('TIVsm-BA').with_ensure('installed') } + describe 'should insttall tsm packages ' do + let(:params) {{ + :tcp_server_address => 'tsm', + }} + it { should contain_tsm__installpkg('TIVsm-BA').with_ensure('installed') } + end describe 'should allow package_ensure to be overridden'do - let(:params) {{ :package_ensure => 'latest'}} + let(:params) {{ + :tcp_server_address => 'tsm', + :package_ensure => 'latest' + }} it do should contain_tsm__installpkg('TIVsm-BA').with({ - 'ensure' => 'latest', - }) + :ensure => 'latest', + }) end end describe 'should allow package_name to be overridden'do - let(:params) {{ :packages => ['deadbeaf'] }} + let(:params) {{ + :tcp_server_address => 'tsm', + :packages => ['deadbeaf'] + }} it { should contain_tsm__installpkg("deadbeaf").with_ensure('installed') } end end + context 'tsm::service on Redhat 6' do let :facts do { @@ -59,11 +75,11 @@ end describe 'when tsm::service_manage is true' do - let :params do - { :service_manage => true } - end + let(:params) {{ + :tcp_server_address => 'tsm', + :service_manage => true, + }} it { should contain_class('tsm::service::redhat')} - end end @@ -78,16 +94,16 @@ it do should contain_tsm__installpkg('TIVsmCba').with({ - 'uri' => /^http:\/\/.*/, - 'adminfile' => '/var/sadm/install/admin/puppet', - }) + :uri => /^http:\/\/.*/, + :adminfile => '/var/sadm/install/admin/puppet', + }) end it do should contain_tsm__installpkg('TIVsmCapi').with({ - 'uri' => /^http:\/\/.*/, - 'adminfile' => '/var/sadm/install/admin/puppet', - }) + :uri => /^http:\/\/.*/, + :adminfile => '/var/sadm/install/admin/puppet', + }) end it { should contain_package('TIVsmCba').that_requires('Package[TIVsmCapi]') } @@ -139,9 +155,10 @@ end describe 'when tsm::service_manage is true' do - let :params do - { :service_manage => true } - end + let(:params) {{ + :tcp_server_address => 'tsm', + :service_manage => true, + }} it { should contain_class('tsm::service::solaris')} end end diff --git a/templates/dsm.sys.erb b/templates/dsm.sys.erb index 07715b5..9a56475 100644 --- a/templates/dsm.sys.erb +++ b/templates/dsm.sys.erb @@ -1,13 +1,25 @@ -SErvername <%= @hostname %> - ERRORLOGNAME /var/log/dsmerror.log - ERRORLOGRetention 31 D - SCHEDLOGName /var/log/dsmsched.log - schedlogretention 30 d - COMMmethod TCPip - TCPPort <%= @tsm_port %> - TCPServeraddress <%= @tsm_host %> - nodename <%= @hostname %> - INCLEXCL /opt/tivoli/tsm/client/ba/bin/InclExcl - PASSWORDAccess generate - domain all-local - makesparsefile no + +************************************************************************ +* * +* Managed by Puppet * +* * +* Tivoli Storage Manager * +* * +************************************************************************ + +SErvername <%= scope.lookupvar("tsm::server_name") %> + COMMMethod <%= scope.lookupvar("tsm::comm_method") %> + TCPPort <%= scope.lookupvar("tsm::tcp_port") %> + TCPServeraddress <%= scope.lookupvar("tsm::tcp_server_address") %> + +************************************************************************ +* EXTENDED CONFIG +<%- if ! @config_hash.nil? -%> +<%- config_hash.keys.sort.each do |config_key| -%> +<%- config_value = @config_hash[config_key] -%> +<%- line = "%-32s %s" % [config_key, config_value] -%> +<%= line %> +<%- end -%> +<%- end -%> +* EXTENDED CONFIG +************************************************************************