Skip to content

Instantly share code, notes, and snippets.

@rodjek

rodjek/allow.pp Secret

Created May 3, 2012 23:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodjek/18c50d8800840696bac0 to your computer and use it in GitHub Desktop.
Save rodjek/18c50d8800840696bac0 to your computer and use it in GitHub Desktop.
Editing hosts.allow with augeas
define hosts::allow($process, $ensure=present) {
if $ensure == 'present' {
augeas { "Add ${name} to ${process} hosts.allow":
context => '/files/etc/hosts.allow',
changes => "set *[process='${process}']/client[last()+1] ${name}",
onlyif => "match *[process='${process}']/client[.='${name}'] size == 0",
}
} else {
# exercise for the reader
}
}
hosts::allow { ['10.128.100.12', '10.128.100.14']:
process => 'nrpe',
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment