Ask Your Question
0

Add line to file for one node

asked 2017-01-18 13:17:01 -0500

mpez0 gravatar image

We have an existing puppet setup that is working well. However, on one node, I want to append a line to a configuration file. How do I do that?

The file is currently fully defined in a manifest. The .pp file includes a file { ... } paragraph with a 'content' attribute that is good for all the other hosts. I have a node/name.yaml file for the node on which I want to append one more line to the file. How do I specify that in the .yaml file? Alternatively, how may I override the entire file {...} paragraph in the .yaml file?

edit retag flag offensive close merge delete

Comments

1

More info is necessary. Please update your question with the actual file resource in question and your hiera setup.

lavaman gravatar imagelavaman ( 2017-01-18 17:08:39 -0500 )edit

I would recommend taking your module/manifest/template able to take a parameter, that is only defined for the node in question. If you try to do something 'funny' like using a file_line resource, you are going to get thrashing between the file and file_line

DarylW gravatar imageDarylW ( 2017-01-19 00:51:09 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-01-22 22:09:26 -0500

ardrigh gravatar image

updated 2017-01-22 22:11:18 -0500

It would help to specify the Puppet version and Hiera configuration you are using.

If you have different levels configured in Hiera you may be able to rely on automatic parameter lookup to set 'content' for each host. https://docs.puppet.com/hiera/1/puppe...

Make $content a variable in the .pp file Set the common host string at a high level like Common/Location/Role/OS. Set the host specific content in the FQDN file. Set content => $content,

That's the simplest and most common way to handle that configuration.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-01-18 13:17:01 -0500

Seen: 67 times

Last updated: Jan 22