How to change template directory in puppet

Atmesh Mishra

My default template directory is

# sudo puppet config print templatedir
/var/lib/puppet/templates

While my modulepath is

# sudo puppet config print modulepath --section master
/etc/puppet/modules:/usr/share/puppet/modules

How do I make template directory relative to module path? i.e. something like /etc/puppet/modules/module_name/template

P.S. I googled it, did not find relevant result. Kindly help.

Matt Schuchard

You can use the template function to return a string using your modulepath https://docs.puppet.com/puppet/latest/function.html#template. If you wanted to reference a template in /etc/puppet/modules/module_name/templates, then you could do template(module_name/template.erb). If you wanted to use an .epp template instead of .erb, then you can use the epp function https://docs.puppet.com/puppet/latest/function.html#epp.

Since the content attribute (https://docs.puppet.com/puppet/latest/types/file.html#file-attribute-content) of the the file resource accepts strings, you can use the string return value of these two functions in your file resources like so:

file { '/path/to/file':
  ensure  => file,
  content => template('module_name/template.erb'),
}

file { '/path/to/file':
  ensure  => file,
  content => epp('module_name/template.epp'),
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Puppet: how to remove a directory and everything in it

From Dev

How to check if a directory exists in puppet

From Dev

Change EJS Template Directory

From Dev

How to include modules from a different directory in puppet

From Dev

How to get Puppet exec to cleanup directory on failure?

From Dev

How to use a template for configuration file in Puppet

From Dev

Puppet inline template with puppet:// in URL

From Dev

How to delete all files in a directory except some globs using Puppet?

From Dev

How can I refer to the current puppet module's files directory?

From Dev

VS Wizard Template - Change Project solution and directory

From Dev

Puppet erb template - how do you compare two integers

From Dev

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

From Dev

How to Change Owner of a Directory

From Dev

how to change directory in ubuntu

From Dev

How to change a directory in perl?

From Dev

How to change the "Index of .." template?

From Dev

how to change the template?

From Dev

How to change the directory .wine of Wine to a different directory

From Dev

How to change the directory .wine of Wine to a different directory

From Dev

How to change the owner and group of a directory by the name of that directory?

From Dev

How to change sub-template in template in Django?

From Dev

How to change TypeLite Output Directory

From Dev

How to change build directory in QtCreator?

From Dev

How to change the current working directory

From Dev

How to change python packages directory

From Dev

How to change destination jar directory

From Dev

How to change the current working directory?

From Dev

How to change TeamCity data directory?

From Dev

How to change upload directory in Vtiger

Related Related

  1. 1

    Puppet: how to remove a directory and everything in it

  2. 2

    How to check if a directory exists in puppet

  3. 3

    Change EJS Template Directory

  4. 4

    How to include modules from a different directory in puppet

  5. 5

    How to get Puppet exec to cleanup directory on failure?

  6. 6

    How to use a template for configuration file in Puppet

  7. 7

    Puppet inline template with puppet:// in URL

  8. 8

    How to delete all files in a directory except some globs using Puppet?

  9. 9

    How can I refer to the current puppet module's files directory?

  10. 10

    VS Wizard Template - Change Project solution and directory

  11. 11

    Puppet erb template - how do you compare two integers

  12. 12

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

  13. 13

    How to Change Owner of a Directory

  14. 14

    how to change directory in ubuntu

  15. 15

    How to change a directory in perl?

  16. 16

    How to change the "Index of .." template?

  17. 17

    how to change the template?

  18. 18

    How to change the directory .wine of Wine to a different directory

  19. 19

    How to change the directory .wine of Wine to a different directory

  20. 20

    How to change the owner and group of a directory by the name of that directory?

  21. 21

    How to change sub-template in template in Django?

  22. 22

    How to change TypeLite Output Directory

  23. 23

    How to change build directory in QtCreator?

  24. 24

    How to change the current working directory

  25. 25

    How to change python packages directory

  26. 26

    How to change destination jar directory

  27. 27

    How to change the current working directory?

  28. 28

    How to change TeamCity data directory?

  29. 29

    How to change upload directory in Vtiger

HotTag

Archive