nosolutions / puppet-tsm

Install and manage TSM (Tivoli Storage Manager) client with puppet
GNU General Public License v3.0
13 stars 21 forks source link

Client registration #26

Closed occelebi closed 6 years ago

occelebi commented 8 years ago

Have you ever thought about automatic client registration ? Having installed and configured necessary things, we still have to register our clients to the Server. We currently register it via dsmc which opens up a dialog where you have to type values respectively. If you have any idea how to automate it, I'd love to hear to contribute ?

tosmi commented 8 years ago

the ideal solution would be via exported resources:

@@tsm::client { $::fqdn:
  ensure => 'present',
  schedule => 'default',
  ...
}

and on the server you collect these resources via:

Tsm::Client <<| |>>

the tsm client class uses exec or whatever to call a command that registers the client on the server. we currently have no need for this solution as tsm is managed by different team, nevertheless an implemention of this feature would be great!

pull requests welcome

toni

tosmi commented 8 years ago

ah, and if the clients are allowed to register themselves you could use the tsm::client class directly without exporting. maybe tsm::client is not the best name... maybe something like tsm::register.

toni

occelebi commented 8 years ago

We also neither manage the tsm server nor have rights to register tsm client. However we used to have rights for our clients.

That's why I want to share one command for those who have their clients that are able to register themselves to tsm server. More(or less) parameters may be needed but basically command is:

dsmadmc -id=ID -password=PASSWORD register node NODENAME PASSWORD userid=none contact=CONTACT domain=DOMAIN

Cem

tosmi commented 8 years ago

ok, thanks for the info. i could implement something like of proof of concept (aka tsm::register), but if we run dsmadmc via exec we need a why to check if the client is already registered. otherwise puppet would try to re-register the node on every puppet run. do you have an idea in mind what would be feasible?

toni

occelebi commented 8 years ago

I know 2 ways to implement that. I prefer first one btw.

First, you can use refreshonly attribute where you can trigger tsm::registration only if a specific file changed such as:

class tsm::registration { exec { $::tsm::registration: refreshonly => true, } }

anchor {'tsm::begin': } -> class { '::tsm::install': } -> class { '::tsm::config': } -> class { '::tsm::registration': } -> class { '::tsm::service': } -> anchor {'tsm::end': }

You may need a better logic here to structure your ordering.

Second, you can use onlyif attribute in exec. (http://www.puppetcookbook.com/posts/exec-onlyif.html)

tosmi commented 8 years ago

hm, what event (resource) should trigger the refresh? refreshonly if is ok, but i need a command to verify that client is already registered (which could be costly if it is run on every puppet run). so refreshonly sounds nicer, but as stated above what resource change should trigger the registration resource?

occelebi commented 8 years ago

Unfortunately I have very limited knowledge of tsm. So I do not really know how to verify client registration. However you may parse output of some tsm binary to find out. In this case onlyif would be more appropriate.

landrypm commented 7 years ago

I am neither a puppet nor a TSM expert. But I was able to use information from this thread to implement a tsm::registration class that works for me. It runs four separate dsmadmc commands to register the new host, add it to two schedules, and add it to a collocation group. I thought I would share in case anyone else stumbles upon this thread as I did. Thanks for the puppet module.

class tsm::registration {

  exec {'register-tsm-client':
    command => "dsmadmc -id=ADMIN -password=ADMINPASSWORD register node ${::fqdn} INITIALPASSWORD userid=none domain=DOMAIN && dsmadmc -id=ADMIN -password=ADMINPASSWORD define association DOMAIN SCHEDULE1 ${::fqdn} && dsmadmc -id=ADMIN -password=ADMINPASSWORD define association DOMAIN SCHEDULE2 ${::fqdn} && dsmadmc -id=ADMIN -password=ADMINPASSWORD define collocmember COLLOCATIONGROUP ${::fqdn}",
    creates => '/etc/adsm/spclicert.kdb',
    path    => ['/bin', '/usr/bin'],
  }

}

I then modified the dependencies at the end of init.pp like this.

  anchor {'tsm::begin': }
  -> class { '::tsm::install': }
  -> class { '::tsm::config': }
  -> class { '::tsm::registration': }
  -> class { '::tsm::service': }
  -> anchor {'tsm::end': }