I've spent the afternoon playing with puppet. It's brilliant and I wish I would have set it up sooner.
My test setup does the following:
- creates a file called /tmp/hello_world
- makes sure that screen and vim-enhanced
- makes sure ntp is installed, running and configured to start (using the default config)
- makes sure the perforce cli is installed
- make sure snmp is configured the way I like it
- /etc/resolv.conf is configured as I expect it
I can create classes that map to my different server rolls. I can make sure key configuration files are up to date -- if I had to change nameservers in /etc/resolv.conf due to IP changes, I'd have to log into every one of my boxes and manually change it. With puppet, it's a variable change and all my systems update.
The following configures your snmp server for you. Stick the following into a pp file:
And this into a snmpd.conf.erb template file in your template directory:
Then configure your systems with:
define snmp_server($community = "public",
$location = "Unknown (edit /etc/snmp/snmpd.conf)",
$contact = "Root (configure /etc/snmp/snmp.local.conf)"
) {
file { "/etc/snmp/snmpd.conf":
ensure => present,
mode => "0644",
owner => "root",
group => "root",
content => template("snmpd.conf.erb"),
}
include snmp_apps
}
class snmp_apps {
package { net-snmp: ensure => installed, }
package { net-snmp-devel: ensure => installed, }
package { net-snmp-utils: ensure => installed, }
service { snmpd:
ensure => true,
enable => true,
subscribe => File["/etc/snmp/snmpd.conf"]
}
}
And this into a snmpd.conf.erb template file in your template directory:
com2sec notConfigUser default
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
view systemview included .1 <%= community %>
access notConfigGroup "" any noauth exact systemview none none
syslocation <%= location %>
syscontact <%= contact %>
Then configure your systems with:
snmp_server { "not used" : community => 'your_commnity', location => 'Springfield', contact => 'root@apple.com' }
Keep in mind that my configs are for Redhat/CentOS systems only -- but you could easily make these cross-unix compatible.
No comments:
Post a Comment