[Puppet Users] Use custom facts in erb templates

2015-10-11 Thread Vikas Kumar
Hello Everyone, I have a YAML file which I am using to generate facts for one of my puppet agents. # facter -p box32.interfaces_ipv4.eth0.bootproto static # This works fine, but I am not sure how to make this work in erb templates. I've tried few options in vain. Forgive my ignorance on thi

Re: [Puppet Users] Use custom facts in erb templates

2015-10-11 Thread Russell Cecala
I asked almost the same question on ask puppet https://ask.puppetlabs.com/question/1295/getting-hiera-data-into-my-erb-template/ On Sun, Oct 11, 2015 at 10:37 AM, Vikas Kumar wrote: > Hello Everyone, > > I have a YAML file which I am using to generate facts for one of my puppet > agents. > > #

Re: [Puppet Users] Use custom facts in erb templates

2015-10-11 Thread Vikas Kumar
Hi Red, I did tried that, but it is not working for me. <%= hostname[interfaces_ipv4][eth0][bootproto] %> or even <%= os[release][major] %> Regards, Vikas On Monday, 12 October 2015 11:19:15 UTC+11, red wrote: > > I asked almost the same question on ask puppet > > > https://ask.puppetlabs.com/

Re: [Puppet Users] Use custom facts in erb templates

2015-10-11 Thread Russell Miller
Don't forget the "@". Ruby scoping rules still apply. <%= @hostname["interfaces_ipv4"]["eth0"]["bootproto"] %> should work, though I haven't tested it, obviously. Also don't forget that puppet scoping rules ALSO apply, so the variable has to be accessible from the class from which the templati

Re: [Puppet Users] Use custom facts in erb templates

2015-10-11 Thread Russell Cecala
What's up with []'s? That doesn't look right to me. Just put your fact. On Sun, Oct 11, 2015 at 5:54 PM, Vikas Kumar wrote: > Hi Red, > > I did tried that, but it is not working for me. > > <%= hostname[interfaces_ipv4][eth0][bootproto] %> > > or even > <%= os[release][major] %> > Regards, > Vi

Re: [Puppet Users] Use custom facts in erb templates

2015-10-11 Thread Russell Cecala
See Russell Miller's email. :) On Sun, Oct 11, 2015 at 6:43 PM, Russell Cecala wrote: > What's up with []'s? That doesn't look right to me. Just put your fact. > > > On Sun, Oct 11, 2015 at 5:54 PM, Vikas Kumar wrote: > >> Hi Red, >> >> I did tried that, but it is not working for me. >> >> <%=

Re: [Puppet Users] Use custom facts in erb templates

2015-10-11 Thread Vikas Kumar
Hi Russel, I tried to use reference the variable as below, but got an error. <%= @hostname["interfaces_ipv4"]["eth0"]["bootproto"] %> Error Oct 12 13:04:06 box32 puppet-agent[37813]: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a

Re: [Puppet Users] Use custom facts in erb templates

2015-10-11 Thread Russell Miller
On Sunday, October 11, 2015 at 7:06:11 PM UTC-7, Vikas Kumar wrote: > > Hi Russel, > > I tried to use reference the variable as below, but got an error. > Vikas, that means either it's not a hash or a requested hash element doesn't exist. I don't have a puppet instance in front of me so I'm no

Re: [Puppet Users] Use custom facts in erb templates

2015-10-11 Thread Vikas Kumar
Russel, I can see the hash on puppet master but not on agent. Can this be the reason ? Importantly, when I try to create a file for custom facts on agent, it gets deleted in the subsequent puppet run. SERVER # facter --puppet box32.interfaces_ipv4.eth0.bootproto static # AGENT # facter --pup

Re: [Puppet Users] Use custom facts in erb templates

2015-10-11 Thread Russell Miller
On Sunday, October 11, 2015 at 7:29:43 PM UTC-7, Vikas Kumar wrote: > > Russel, > > I can see the hash on puppet master but not on agent. Can this be the > reason ? Importantly, when I try to create a file for custom facts on > agent, it gets deleted in the subsequent puppet run. > > Yes, the