You may want to have a look at this function: https://github.com/puppetlabs/puppetlabs-nodesearch
it doest map exactly to your use case, but the implementation of it is close to what the implementation for your solution may look like. Its worth noting that once the next generation of storeconfigs comes out (which is REALLY soon), it will have better APIs to support these kinds of functions and I intend to write puppet functions that support these kinds of use cases. On Wed, May 9, 2012 at 12:33 PM, Joe <[email protected]> wrote: > Hello, > > I'm trying to figure out the best solution for using facts of other > nodes in manifests. > > I understand the use of exported configs and the concat module but, I > think, when using someone's contributed module, unless they wrote the > module using those solutions, I would have to rewrite the module > myself. > > Here is the best way I can explain the particular problem I'm running > into. Maybe I'm totally on the wrong path with this. > > class my_mysql_server { > class { 'mysql::server': } > # other stuff as needed > # ... > } > > node node1.example.com { > class { 'my_mysql_server': } > } > > node node2.example.com { > class { 'some::app::db': > db_username => 'foo', > db_password => 'password', > db_host => $my_mysql_server::fqdn, > } > } > > In this case, 'some::app' is a contributed module. $db_host in 'db.pp' > simply references a single variable in a template - not a loop and not > using concat. > > This does work, but I'm not entirely comfortable with it. For one, if > my_mysql_server is never applied, $fqdn will not be available. This > generally won't happen in the above example, but it's still a concern > I have. Secondly, if I choose to apply my_mysql_server to two nodes, > there would be more than one result for db_host. I'm not exactly sure > how to get around this. > > What's the best practice for this type of situation? Should I just > hard-code the fqdn of my_mysql_server and be done with it? Or is there > a more dynamic way to do this? > > Thanks, > Joe > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
