Skip to content

Instantly share code, notes, and snippets.

@vStone
Created May 29, 2013 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vStone/5668751 to your computer and use it in GitHub Desktop.
Save vStone/5668751 to your computer and use it in GitHub Desktop.
Dirty augeas from puppet apply hack
## Use a custom lens to do something.
class example::custom {
if $::servername {
} else {
warning("puppet apply runs do not detect the correct lensdir: using dirty hack")
$lensdir = inline_template("<%= File.expand_path(File.join(File.dirname(scope.source.file),'../lib/augeas/lenses')) %>")
Augeas {
load_path => "${lensdir}"
}
}
file {'/tmp/example-custom-test':
ensure => 'present',
} ->
augeas {'example-custom-test':
lens => 'Test.lns',
incl => '/tmp/example-custom-test',
changes => [
'set 01 foobar'
],
onlyif => "match *[. = 'foobar'] size == 0",
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment