Skip to content

Instantly share code, notes, and snippets.

@binford2k
Last active June 3, 2020 18:08
Show Gist options
  • Save binford2k/73e81e9179d87d56af15f081d6c3259e to your computer and use it in GitHub Desktop.
Save binford2k/73e81e9179d87d56af15f081d6c3259e to your computer and use it in GitHub Desktop.
# A quick and untested implementation of a deferred_epp() function to abstract
# the fiddly bits for deferring a template and render it agent side.
#
# Note: This depends on my find_template() PR.
#
# Note: If you're resolving variables agent side, then you'll have to defer
# them as well. Pass them in via the $variables hash like this example:
#
# $variables = {
# 'password' => Deferred('vault_lookup::lookup',
# ["secret/test", 'https://vault.docker:8200']),
# }
# file { '/etc/secrets.conf':
# ensure => file,
# content => deferred_epp('mymod/secret.conf.epp', $variables),
# }
#
function stdlib::deferred_epp(String $path, Hash $variables) >> Deferred {
Deferred('inline_epp',
[find_template($path).file, $variables]),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment