How to read entire files in Puppet verbatim (without parsing like template)?

Mikhail T.

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...

Dominic Cleal

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I turn entire stdin into a command line argument verbatim?

From Dev

How to change template directory in puppet

From Dev

How can I treat strings read from SQL as verbatim?

From Dev

Read ZIP files from S3 without downloading the entire file

From Dev

How do Modules like Openpyxl create/read Excel files

From Dev

How to use a template for configuration file in Puppet

From Dev

How to read Freemarker Template files from src/main/resources folder?

From Dev

Parsing multiple files in an XML-like format

From Dev

Read verbatim string from file

From Dev

Django include html without parsing template tags

From Dev

how to remove all /etc/*.txt files with puppet

From Dev

Puppet inline template with puppet:// in URL

From Dev

How to read large binary files in node js without a blocking loop?

From Dev

R: How to quickly read large .dta files without RAM Limitations

From Dev

Matlab , How to read files in a zip.file without unzipping

From Dev

How to archive files and not entire path

From Dev

How to remap characters like in vim but in the entire OS?

From Dev

Parsing Bison/YACC .y files without parsing all of the C language

From Dev

Parsing Bison/YACC .y files without parsing all of the C language

From Dev

How do I add JS HTML files to a @Template in Angular 2 (Like $templateCache)?

From Dev

Puppet erb template - how do you compare two integers

From Dev

How to template like ERB in Python?

From Dev

Groovy: How can I read/compare lines from two files, without loading one or both files into memory

From Dev

How to read entire stream into a std::vector?

From Dev

How to read the entire worksheet from excel

From Dev

How to read the entire "Unauthorized changes blocked" message?

From Dev

How to read in an entire binary blob in R?

From Dev

How do I read a Hiera value from a Puppet function?

From Dev

How to use verbatim strings with interpolation?

Related Related

  1. 1

    How do I turn entire stdin into a command line argument verbatim?

  2. 2

    How to change template directory in puppet

  3. 3

    How can I treat strings read from SQL as verbatim?

  4. 4

    Read ZIP files from S3 without downloading the entire file

  5. 5

    How do Modules like Openpyxl create/read Excel files

  6. 6

    How to use a template for configuration file in Puppet

  7. 7

    How to read Freemarker Template files from src/main/resources folder?

  8. 8

    Parsing multiple files in an XML-like format

  9. 9

    Read verbatim string from file

  10. 10

    Django include html without parsing template tags

  11. 11

    how to remove all /etc/*.txt files with puppet

  12. 12

    Puppet inline template with puppet:// in URL

  13. 13

    How to read large binary files in node js without a blocking loop?

  14. 14

    R: How to quickly read large .dta files without RAM Limitations

  15. 15

    Matlab , How to read files in a zip.file without unzipping

  16. 16

    How to archive files and not entire path

  17. 17

    How to remap characters like in vim but in the entire OS?

  18. 18

    Parsing Bison/YACC .y files without parsing all of the C language

  19. 19

    Parsing Bison/YACC .y files without parsing all of the C language

  20. 20

    How do I add JS HTML files to a @Template in Angular 2 (Like $templateCache)?

  21. 21

    Puppet erb template - how do you compare two integers

  22. 22

    How to template like ERB in Python?

  23. 23

    Groovy: How can I read/compare lines from two files, without loading one or both files into memory

  24. 24

    How to read entire stream into a std::vector?

  25. 25

    How to read the entire worksheet from excel

  26. 26

    How to read the entire "Unauthorized changes blocked" message?

  27. 27

    How to read in an entire binary blob in R?

  28. 28

    How do I read a Hiera value from a Puppet function?

  29. 29

    How to use verbatim strings with interpolation?

HotTag

Archive