-
-
Save rodjek/18c50d8800840696bac0 to your computer and use it in GitHub Desktop.
Editing hosts.allow with augeas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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