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.
Yes, it is.
Here is the link to the official documentation: https://puppet.com/docs/puppet/latest/lang_exported.html
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.