Skip to content

Instantly share code, notes, and snippets.

@binford2k
Last active February 16, 2019 09:52
Show Gist options
  • Save binford2k/efd953569328baf3f64487b78fefbc62 to your computer and use it in GitHub Desktop.
Save binford2k/efd953569328baf3f64487b78fefbc62 to your computer and use it in GitHub Desktop.
Generate a templated file on the agent, using secrets resolved agent side.
$variables = {
'password' => Deferred('vault_lookup::lookup',
["secret/test", 'https://vault.docker:8200']),
}
# use inline_epp(), and file() to compile the template source into the catalog
file { '/etc/secrets.conf':
ensure => file,
content => Deferred('inline_epp',
[file('mymodule/secrets.conf.epp'), $variables]),
}
@hlindberg
Copy link

Note ERB is not available when resolving deferred values.

@hlindberg
Copy link

It is possible to reference a template in the templates directory by first locating the module root with the function module_directory() in puppet and then adding the relative path to templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment