Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm diving into Puppet in our environment and I'm realizing there are many files I'd like to build that use Puppet Facts and inventory data about our environment.

Is it possible, for example, to assemble an /etc/hosts file based on nodes which include a certain class? Another example would be writing scripts to compare our existing Nagios configuration against the Puppet inventory.

share|improve this question

2 Answers 2

up vote 4 down vote accepted

It is, indeed:

http://docs.puppetlabs.com/guides/exported_resources.html

share|improve this answer
    
So am I correct in understanding you can only gather configurations that you are setting? For example, you couldn't gather the contents of a file unless you set it using @@file { content => "Some stuff" }? –  Kyle Smith Jul 11 '11 at 21:56
    
You can gather facts, but I am not sure how you'd gather and push file contents except by making a custom fact. –  Cakemox Jul 12 '11 at 9:14

In addition to Cakemox's answer, see this module as an example of that. It exports the ssh server key of each server to all ssh clients. Likewise, you could be exporting a host entry, or some part of a config file, etc.

I don't have it public (because its still very much a work in progress), but I have my JBoss servers exporting their IPs to the pg_hba of the Postgres servers whose databases they use, as well as having the postgres database declarations exporting lines that are used to compose the datasource xml file for the JBoss apps that use them.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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