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 puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to