Skip to content

Instantly share code, notes, and snippets.

@jedi4ever
Created September 11, 2012 13:26
Show Gist options
  • Save jedi4ever/3698451 to your computer and use it in GitHub Desktop.
Save jedi4ever/3698451 to your computer and use it in GitHub Desktop.
Puppet loop over hash and pass array of args to sysctl
Exec { path => '/usr/bin:/usr/sbin/:/bin:/sbin' }
$sysctl_settings = {
# On Hardware Node we generally need
# packet forwarding enabled and proxy arp disabled
"net.ipv4.ip_forward" => 1 ,
"net.ipv6.conf.default.forwarding" => 1 ,
"net.ipv6.conf.all.forwarding" => 1 ,
"net.ipv4.conf.default.proxy_arp" => 0 ,
# Enables source route verification
"net.ipv4.conf.all.rp_filter" => 1,
# Enables the magic-sysrq key
"kernel.sysrq" => 1,
# We do not want all our interfaces to send redirects
"net.ipv4.conf.default.send_redirects" => 1,
"net.ipv4.conf.all.send_redirects" => 0
}
$keys = keys($sysctl_settings)
sysctl::value { $keys:
value => $sysctl_settings[$name],
require => Package['vzctl']
}
@jedi4ever
Copy link
Author

Working version

$sysctl_settings = {
# On Hardware Node we generally need
# packet forwarding enabled and proxy arp disabled
"net.ipv4.ip_forward" => { value => 1 },
"net.ipv6.conf.default.forwarding" => { value => 1 },
"net.ipv6.conf.all.forwarding" => { value => 1 },
"net.ipv4.conf.default.proxy_arp" => { value => 0 },

# Enables source route verification                                        
"net.ipv4.conf.all.rp_filter" => { value => 1 },                           

# Enables the magic-sysrq key                                              
"kernel.sysrq" => { value => 1 } ,                                         

# We do not want all our interfaces to send redirects                      
"net.ipv4.conf.default.send_redirects" => { value => 1},                   
"net.ipv4.conf.all.send_redirects"     => { value => 0}.                   

}

$sysctl_defaults = {
require => Package['vzctl']
}

create_resources(sysctl::value , $sysctl_settings, $sysctl_defaults)

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment