Ask Your Question
0

How to render a specific template (file resource) for a specific client?

asked 2015-04-06 19:25:52 -0500

updated 2015-04-06 19:33:08 -0500

What's the puppet agent command to see how a file resource would be rendered for a specific machine (w/o actually applying it --noop but seeing the diff)? Does this resource have to be in the catalog or can it be any resource even those which wouldn't normally be applied?

I know it has to be invoked on the client, not on the master. But, is there any way to determine it from the master (of course w/o diff) but based on the facts from the last puppet-run? (I'm happy if only the first q gets answered.)

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2015-04-07 14:29:07 -0500

WhatsARanjit gravatar image

If you look in the directory # $(puppet master --configprint vardir)/yaml/facts, you'll see that there is a fact cache for all your nodes. If you don't want to mess with a real node, copy the node's fact cache to test.yaml (for example). Classify your test node with the class containing your ERB in site.pp.

node test {
 include some_class
}

Then you can run:

puppet master --compile test

And you'll get what would be the catalog for the agent known as test. The master will automatically read the facts in the yaml file with the matching name. Search through this output for the path of your file and you'll see the content attribute listed there.

edit flag offensive delete link more

Comments

Alright, it's known that ppm caches each node's facts. I had to add --environment development since I use a dir env. But then it prints the file content. »cool« Though it's unreadable as it's a string with all the newline escapes, »sigh«.

Kai Burghardt gravatar imageKai Burghardt ( 2015-04-07 16:39:53 -0500 )edit

Any chance to run this on the client (on the node) seeing the diff puppet agent -tv --noop <some magic selecting a resource by $title> and/or with resources which don't belong to the catalog?

Kai Burghardt gravatar imageKai Burghardt ( 2015-04-07 16:40:59 -0500 )edit

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: 2015-04-06 19:25:52 -0500

Seen: 609 times

Last updated: Apr 07 '15