access facts in ENC

354 views
Skip to first unread message

Hai Tao

unread,
Jul 23, 2012, 7:07:31 PM7/23/12
to puppet...@googlegroups.com
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.

Craig White

unread,
Jul 23, 2012, 7:47:52 PM7/23/12
to puppet...@googlegroups.com
----
$hostname should work
$fqdn is an option but that will likely carry a domain name with it.

Craig

Hai Tao

unread,
Jul 23, 2012, 7:56:48 PM7/23/12
to puppet...@googlegroups.com
I am talking about facts other than hostname, such as ipaddress, custom facts.
> --
> You received this message because you are subscribed to the Google Groups "Puppet Users" group.
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
>



--
Hai Tao

Brian Gupta

unread,
Jul 23, 2012, 8:25:49 PM7/23/12
to puppet...@googlegroups.com
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

Stefan Schulte

unread,
Jul 24, 2012, 12:34:26 PM7/24/12
to puppet...@googlegroups.com
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

Reply all
Reply to author
Forward
0 new messages