Hi, As the only paramater we can pass to the ENC is the hostname, I wonder if there is a way to access a node''s fact in the ENC script? I know a workaround is to query my Fact database ( I am using Mysql), but I like to know if I can use a variable directly, for example, $ipaddress? Thanks. Hai T. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Jul 23, 2012, at 4:07 PM, Hai Tao wrote:> Hi, > > As the only paramater we can pass to the ENC is the hostname, I wonder > if there is a way to access a node''s fact in the ENC script? > > I know a workaround is to query my Fact database ( I am using Mysql), > but I like to know if I can use a variable directly, for example, > $ipaddress?---- $hostname should work $fqdn is an option but that will likely carry a domain name with it. Craig -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
I am talking about facts other than hostname, such as ipaddress, custom facts. On Mon, Jul 23, 2012 at 4:47 PM, Craig White <craig.white@ttiltd.com> wrote:> > On Jul 23, 2012, at 4:07 PM, Hai Tao wrote: > >> Hi, >> >> As the only paramater we can pass to the ENC is the hostname, I wonder >> if there is a way to access a node''s fact in the ENC script? >> >> I know a workaround is to query my Fact database ( I am using Mysql), >> but I like to know if I can use a variable directly, for example, >> $ipaddress? > ---- > $hostname should work > $fqdn is an option but that will likely carry a domain name with it. > > Craig > > -- > 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+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. >-- Hai Tao -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Your ENC script can pretty much do whatever you want it to do. I''m not exactly following what you want to do with the facts, but you could upload them to your ENC like so: https://github.com/theforeman/puppet-foreman/blob/master/templates/external_node.rb.erb -Brian On Mon, Jul 23, 2012 at 7:56 PM, Hai Tao <ehaitao@gmail.com> wrote:> I am talking about facts other than hostname, such as ipaddress, custom facts. > > On Mon, Jul 23, 2012 at 4:47 PM, Craig White <craig.white@ttiltd.com> wrote: >> >> On Jul 23, 2012, at 4:07 PM, Hai Tao wrote: >> >>> Hi, >>> >>> As the only paramater we can pass to the ENC is the hostname, I wonder >>> if there is a way to access a node''s fact in the ENC script? >>> >>> I know a workaround is to query my Fact database ( I am using Mysql), >>> but I like to know if I can use a variable directly, for example, >>> $ipaddress? >> ---- >> $hostname should work >> $fqdn is an option but that will likely carry a domain name with it. >> >> Craig >> >> -- >> 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+unsubscribe@googlegroups.com. >> For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. >> > > > > -- > Hai Tao > > -- > 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+unsubscribe@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-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Mon, Jul 23, 2012 at 08:25:49PM -0400, Brian Gupta wrote:> Your ENC script can pretty much do whatever you want it to do. I''m not > exactly following what you want to do with the facts, but you could > upload them to your ENC like so: > https://github.com/theforeman/puppet-foreman/blob/master/templates/external_node.rb.erb > > -Brian >This may also be helpful: http://docs.puppetlabs.com/guides/external_nodes.html#tricks-notes-and-further-reading -Stefan -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.