This is an example to install the newrelic-sysmond package on the Puppet Agent.
class system::newrelic-sysmond ($licensekey) { package { "newrelic-sysmond": ensure => installed, } exec { 'Insert newrelic license key': command => "nrsysmond-config --set license_key=$licensekey", require => Package['newrelic-sysmond'], creates => '/etc/newrelic/key_added', } exec { 'Restart newrelic system monitor': command => "/etc/init.d/newrelic-sysmond start", require => Exec['Insert newrelic license key'], creates => '/etc/newrelic/key_added', } exec { 'Create the key_added file': command => "echo key_added > /etc/newrelic/key_added", require => Exec['Restart newrelic system monitor'], creates => '/etc/newrelic/key_added', } }
Done =)
Thanks for example really useful. Just wondering what the best way of calling this would be should I include this class in init.pp like this
or would there be a better way?
Thank you very much for the help. 🙂
LikeLike
It really depends on how you structure the puppet codes. So if it works and ppl understand it, that’s good.
If you are looking for puppet design pattern, here is a very good resource.
Designing Puppet – Roles and Profiles.
LikeLike