I have a relatively simple manual task that I am trying to automate using Puppet.
Steps I want to perform via Puppet:
- Copy tarball over from Puppetmaster to several server 'client' nodes.
- Untar the tarball on said server node.
- Execute, one at a time, each of the installation agents 'install.sh' file.
- Clean up (remove) original tarball bundle.
I was hoping not to have one huge init.pp file, but somehow have it a bit modular so that I could have a different class (?) for each of the agents that need to be installed on the 'client' server nodes.
How would I go about doing this? Examples are preferred so I can learn.
I tried something like this (to do the initial copy, untar and cleanup), but it's not exactly 'pretty'.
class dd_bundle {
file { '/opt/apps':
ensure => 'directory',
}
file { '/opt/apps/dd-app-bundle.tar.gz':
source => 'puppet:///modules/dd_bundle/dd-app-bundle.tar.gz',
ensure => file,
replace => false,
mode => '0664';
}
exec { 'tar -xf /opt/apps/dd-app-bundle.tar.gz':
cwd => '/opt/apps',
path => ['/usr/bin', '/usr/sbin',],
}
tidy { '/opt/apps/dd-app-bundle.tar.gz': }
}
It would be nice if there was a way I could just somehow have a way to have individual classes and then add them to the init.pp file, then I could make adjustments to each individual class (application) for doing its install part.
Just trying to figure out a streamlined way to make a manual process be automated.