Skip to content

Instantly share code, notes, and snippets.

@raphink
Created July 7, 2015 14:21
Show Gist options
  • Save raphink/79e720badc8e69859100 to your computer and use it in GitHub Desktop.
Save raphink/79e720badc8e69859100 to your computer and use it in GitHub Desktop.
define java::property (
$ensure = 'present',
$value = undef,
$target,
) {
case $ensure {
'present': {
$changes = "set ${name} ${value}"
}
'absent': {
$changes = "rm ${name}"
}
default: {
fail "Wrong value for \$ensure: ${ensure}"
}
}
augeas { "java property ${name} in ${target}":
incl => $target,
lens => 'Properties.lns',
changes => $changes,
}
}
java::property { 'some.key':
value => 'foo',
target => '/tmp/test.properties',
}
java::property { 'somekey':
ensure => absent,
target => '/tmp/test.properties',
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment