I need to create a bunch of ssh_authorized_keys
resources. The resource expects its key
-attribute to be the public key itself -- there is no way to refer to a file containing the key.
Because the keys are very long and because I already have them in files, I'd rather Puppet read them from the files instead of me quoting them in the manifest.
I can imagine a few other use-cases too.
Is there already a function to read a specified file verbatim, without attempting to interpret them as template()
does?
For public-keys I can, actually, get away with template()
, but that carries an overhead of a parsing-attempt. Also, in some other cases, depending on the file's contents, the parsing may, actually, "fail" or, worse, not fail, but quietly alter the contents...
Is there already a function to read a specified file verbatim, without attempting to interpret them as template() does?
The file()
function will read and return the contents of a file on the Puppet master (or wherever the catalog's being compiled), similar to template()
as you described.
Call it with a path such as ssh_keys/foo.key
to load the file ssh_keys/files/foo.key
within the modulepath.
Note that this function requires Puppet 3.7 or higher to load from the modulepath in the same way as template()
. Prior to that it only worked with absolute paths, though has been in every major release.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments