Skip to content

Instantly share code, notes, and snippets.

@kwilczynski
Created August 25, 2011 08:43
Show Gist options
  • Save kwilczynski/1170253 to your computer and use it in GitHub Desktop.
Save kwilczynski/1170253 to your computer and use it in GitHub Desktop.
Usage of resolve_source
How to fall-back to template when the source file is not present on the Puppet Master?
$file = '/tmp/file.txt'
$source = resolve_source("puppet://test/file.txt.${fqdn}",
"puppet://test/file.txt.${domain}",
'puppet://test/file.txt')
if empty($source) {
file { $file:
content => template('test/file.txt.erb')
}
} else {
file { $file:
source => $source
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment