You could use stored configs and collect all the values for all the hosts on 
all the hosts.  So something like this:

node foo { ipaddress = 1.2.3.4 }
node bar { ipaddress = 5.6.7.8 }

class jumpstart {
   @@file{ "/etc/sysidcfg.d/$hostname":
        content => template("sysidcfg.erb"),
        tag         => sysidcfg,
        notify    => Exec["rebuild sysidcfg"];
    }
   
    File<<| tag == "sysidcfg" |>>

    file {"/etc/sysidcfg.d": 
        ensure => directory;
    }

    exec {"rebuild sysidcfg":
        command => "cat /etc/sysidcfg.d/* > /etc/sysidcfg.erb",
        unless       => "test \"`cat /etc/sysidcfg.d/* | md5sum | awk '{print 
\$1}'`\" == \"`cat /etc/sysidcfg | md5sum | awk '{print \$1}'`\"";
    }   
}

sysidcfg.erb:
hostname=<%= hostname %> ip_address=<%= ipaddress %>



I think you could also use extlookup, but I don't have any experience with 
that.   And I pulled the above manifest out of my back side, so you might have 
to tinker with it.

On Feb 2, 2010, at 9:27 AM, John Lyman wrote:

> I'm trying to figure out the best way to achieve the following...
> 
> Inside of each node definition, I have variables for ip address,
> default router, dns server, etc.  I have a jumpstart module that has
> several different file resources that use templates.  In each
> template, I would like to be able to use the values of the variables
> in all nodes.
> 
> For example:
> node foo { ipaddress => 1.2.3.4 }
> node bar { ipaddress => 5.6.7.8 }
> 
> class jumpstart {
>  jumpstart_client = [ "foo", "bar" ]
>  file { "sysidcfg":
>    content => template("sysidcfg.erb")
>  }
> }
> 
> sysidcfg.erb:
> <% jumpstart_client.each do |client| -%>
> hostname=<%= client %> ip_address=<%= client::ipaddress %>
> <% end -%>
> 
> I don't think the above is possible.  What is the best way to
> accomplish this (if any)?  I think this is where exported resources
> would come in to play, but in this case they will not work because I
> want the info on the jumpstart server before puppet is even installed/
> run on the node.  In other words, I want to define the node in puppet,
> do a catalog run on the jumpstart server to update it's config files
> based on the new node definition, and then jumpstart the node (which
> also installs puppet).
> 
> Any ideas?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to puppet-us...@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.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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