Puppet: System Administration Automated

Support

The Puppet Modules page has links to the following sysctl code:

* http://spook.wpi.edu/sysctl * http://github.com/duritong/puppet-sysctl

I have some machines on which I would like to manage some /etc/sysctl.conf entries. All the machines are EL5, and the settings should look like this:

default

/etc/sysctl.conf is untouched

general (most machines)

net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.conf.all.accept_redirects=0
net.ipv4.conf.all.send_redirects=0
net.ipv4.icmp_ignore_bogus_error_responses=1
net.ipv4.conf.all.log_martians=1
net.ipv4.conf.all.proxy_arp=0

GPFS (some machines)

#for GPFS, from the Deployment Guide
# increase Linux TCP buffer limits
net.core.rmem_max = 8388608
net.core.wmem_max = 8388608
# increase default and maximum Linux TCP buffer sizes
net.ipv4.tcp_rmem = 4096 262144 8388608
net.ipv4.tcp_wmem = 4096 262144 8388608
# increase max backlog to avoid dropped packets
net.core.netdev_max_backlog=2500

10GigE (few machines)

# for 10 GigE, use this
net.core.netdev_max_backlog = 30000 

In my initial puppet implementation, I had a single master sysctl.conf file and just had puppet copy it to the clients. Now I'd like to make this a module with more granular functionality.

In this implementation, I copied the files into $PUPPET_HOME/plugins/ and made a sysctl module directory as described in Module Organisation

On my first attepmt, I simply added this to manifests/site.pp

sysctl { "kernel.sysrq":
  val => "1",
}

The puppetd run said:

err: Could not retrieve catalog: Could not find resource type sysctl at /etc/puppet/manifests/site.pp:14 on node fqdn.here.com

I found these two relevant pages: #1466 and Plugins InModules. Following the Plugins InModules page, I moved the plugins directory to inside my module, so that it is now in /etc/puppet/modules/sysctl/plugins instead of /etc/puppet/plugins. I also added pluginsync = true to the main section of puppet.conf on the puppetmaster. Lo and behold:

  alex@pgfi-chekh-d2:~$ sudo puppetd --test --server repo.genomics.upenn.edu
[sudo] password for alex: 
info: Retrieving plugins
notice: /File[/var/lib/puppet/lib/puppet]/ensure: created
notice: /File[/var/lib/puppet/lib/puppet/provider]/ensure: created
notice: /File[/var/lib/puppet/lib/puppet/provider/sysctl]/ensure: created
notice: /File[/var/lib/puppet/lib/puppet/provider/sysctl/parsed.rb]/ensure: created
notice: /File[/var/lib/puppet/lib/puppet/type]/ensure: created
notice: /File[/var/lib/puppet/lib/puppet/type/sysctl.rb]/ensure: created
notice: Ignoring cache
info: No classes to store
info: Caching catalog at /var/lib/puppet/state/localconfig.yaml
notice: Starting catalog run
notice: //Sysctl[kernel.sysrq]/ensure: created
info: Filebucket[/var/lib/puppet/clientbucket]: Adding /etc/sysctl.conf(3628007f7a72844bdbe19bde756b5064)
notice: Finished catalog run in 0.05 seconds

The line kernel.sysrq = 1 was added to my /etc/sysctl.conf

Now I can add lines like this to my puppet manifests:

# increase Linux TCP buffer limits
  sysctl { "net.core.rmem_max": val => "8388608", }
  sysctl { "net.core.wmem_max": val => "8388608", }
# increase default and maximum Linux TCP buffer sizes
  sysctl { "net.ipv4.tcp_rmem": val => "4096 262144 8388608", }
  sysctl { "net.ipv4.tcp_wmem": val => "4096 262144 8388608", }