1

I want to push some config file to my all servers by puppet. File is almost the same for all servers, but there is one change - hostname.

I've created module in puppet with manifest and temp-conf-file. I include to all node. All is fine.

My question is: how can i push that file to all server with change one/two lines in that file. But i don't want to set config file in modules for all. I want to use one file and during the push change in side two lines.

Thank you for help.

Best,

Rafal

| improve this question | | | | |
5

I would use a template. Set your file resource to use content instead of source:

content => template("mymodule/temp-conf-file.erb"),

Then have the template substitute the hostname. The template would be located in the templates subdirectory of your module:

# This file is managed by puppet
... random config stuff ...
hostname = <%= hostname %>

You can also use fqdn or something else.

Official documentation: https://puppet.com/docs/puppet/latest/lang_template.html

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.