2

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.

2 Answers 2

4

Yes, it is.

Here is the link to the official documentation: https://puppet.com/docs/puppet/latest/lang_exported.html

2
  • 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, 2011 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, 2011 at 9:14
3

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.

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.