Hi everyone, I have a question that I can''t seem to find a solution to. I am using hiera, and having a hard time understanding how to pass environments for dynamic look ups. For example, if my hiera.yaml looks like this: :hierarchy: - %{::environment} - common How / where do I pass the $environment variable that the host will know it''s in a particular environment. I had something working before using an ENC, but I do not have an option of using an ENC this time around. Thanks! Tony -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
http://docs.puppetlabs.com/guides/environment.html#on-the-agent-node I put it in the [agent] block of puppet.conf “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes) ----- Original Message ----- From: "Tony C" <tonyjchong@gmail.com> To: puppet-users@googlegroups.com Sent: Monday, April 8, 2013 1:28:37 PM Subject: [Puppet Users] More Hiera and Environment questions Hi everyone, I have a question that I can''t seem to find a solution to. I am using hiera, and having a hard time understanding how to pass environments for dynamic look ups. For example, if my hiera.yaml looks like this: :hierarchy: - %{::environment} - common How / where do I pass the $environment variable that the host will know it''s in a particular environment. I had something working before using an ENC, but I do not have an option of using an ENC this time around. Thanks! Tony -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en . For more options, visit https://groups.google.com/groups/opt_out . -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Oops, I copied and pasted the wrong thing. hiera.yaml :yaml: :datadir: /etc/puppetlabs/hieradata/%{::environment} :hierarchy: - common - %{::application} On my agent puppet.conf, I have tried what you suggested already but it can''t find the value in hiera. [agent] certname = xxxxxxxxxx server = xxxxxxxxxx report = true classfile = $vardir/classes.txt localconfig = $vardir/localconfig graph = true pluginsync = true environment = dev application = app_1 On Monday, April 8, 2013 10:33:26 AM UTC-7, Ygor wrote:> > http://docs.puppetlabs.com/guides/environment.html#on-the-agent-node > > I put it in the [agent] block of puppet.conf > > “Sometimes I think the surest sign that intelligent life exists elsewhere > in the universe is that none of it has tried to contact us.” > Bill Waterson (Calvin & Hobbes) > > ------------------------------ > *From: *"Tony C" <tonyj...@gmail.com <javascript:>> > *To: *puppet...@googlegroups.com <javascript:> > *Sent: *Monday, April 8, 2013 1:28:37 PM > *Subject: *[Puppet Users] More Hiera and Environment questions > > Hi everyone, > > I have a question that I can''t seem to find a solution to. > > I am using hiera, and having a hard time understanding how to pass > environments for dynamic look ups. > > For example, if my hiera.yaml looks like this: > > :hierarchy: - %{::environment} - common > > How / where do I pass the $environment variable that the host will know > it''s in a particular environment. I had something working before using an > ENC, but I do not have an option of using an ENC this time around. > > Thanks! > > Tony > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-users...@googlegroups.com <javascript:>. > To post to this group, send email to puppet...@googlegroups.com<javascript:> > . > Visit this group at http://groups.google.com/group/puppet-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Ellison Marks
2013-Apr-08 17:45 UTC
Re: [Puppet Users] More Hiera and Environment questions
If you''re running puppet as a service, have you restarted the service since adding that value? On Monday, April 8, 2013 10:40:45 AM UTC-7, Tony C wrote:> > Oops, I copied and pasted the wrong thing. > > > hiera.yaml > > :yaml: > :datadir: /etc/puppetlabs/hieradata/%{::environment} > :hierarchy: > - common > - %{::application} > > > On my agent puppet.conf, I have tried what you suggested already but it > can''t find the value in hiera. > > [agent] > certname = xxxxxxxxxx > server = xxxxxxxxxx > report = true > classfile = $vardir/classes.txt > localconfig = $vardir/localconfig > graph = true > pluginsync = true > environment = dev > application = app_1 > > > On Monday, April 8, 2013 10:33:26 AM UTC-7, Ygor wrote: >> >> http://docs.puppetlabs.com/guides/environment.html#on-the-agent-node >> >> I put it in the [agent] block of puppet.conf >> >> “Sometimes I think the surest sign that intelligent life exists elsewhere >> in the universe is that none of it has tried to contact us.” >> Bill Waterson (Calvin & Hobbes) >> >> ------------------------------ >> *From: *"Tony C" <tonyj...@gmail.com> >> *To: *puppet...@googlegroups.com >> *Sent: *Monday, April 8, 2013 1:28:37 PM >> *Subject: *[Puppet Users] More Hiera and Environment questions >> >> Hi everyone, >> >> I have a question that I can''t seem to find a solution to. >> >> I am using hiera, and having a hard time understanding how to pass >> environments for dynamic look ups. >> >> For example, if my hiera.yaml looks like this: >> >> :hierarchy: - %{::environment} - common >> >> How / where do I pass the $environment variable that the host will know >> it''s in a particular environment. I had something working before using an >> ENC, but I do not have an option of using an ENC this time around. >> >> Thanks! >> >> Tony >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to puppet-users...@googlegroups.com. >> To post to this group, send email to puppet...@googlegroups.com. >> Visit this group at http://groups.google.com/group/puppet-users?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Yes, I have restarted every service. If I replace the %{environment} and %{application} with the actual values in hiera.yaml, everything works so I know at least I''m on the right track. I have also run the hiera command with -c with environment=dev application=app1 and that works as well. Tony -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
I think the double-colon is the problem. In my hiera.yaml , I have :hierarchy: - %{environment}/%{hostname} - %{environment}/common - %{hostname} - common And it works “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes) ----- Original Message ----- From: "Tony C" <tonyjchong@gmail.com> To: puppet-users@googlegroups.com Sent: Monday, April 8, 2013 1:40:45 PM Subject: Re: [Puppet Users] More Hiera and Environment questions Oops, I copied and pasted the wrong thing. hiera.yaml :yaml: :datadir: /etc/puppetlabs/hieradata/%{::environment} :hierarchy: - common - %{::application} On my agent puppet.conf, I have tried what you suggested already but it can''t find the value in hiera. [agent] certname = xxxxxxxxxx server = xxxxxxxxxx report = true classfile = $vardir/classes.txt localconfig = $vardir/localconfig graph = true pluginsync = true environment = dev application = app_1 On Monday, April 8, 2013 10:33:26 AM UTC-7, Ygor wrote: http://docs.puppetlabs.com/guides/environment.html#on-the-agent-node I put it in the [agent] block of puppet.conf “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes) From: "Tony C" < tonyj...@gmail.com > To: puppet...@googlegroups.com Sent: Monday, April 8, 2013 1:28:37 PM Subject: [Puppet Users] More Hiera and Environment questions Hi everyone, I have a question that I can''t seem to find a solution to. I am using hiera, and having a hard time understanding how to pass environments for dynamic look ups. For example, if my hiera.yaml looks like this: :hierarchy: - %{::environment} - common How / where do I pass the $environment variable that the host will know it''s in a particular environment. I had something working before using an ENC, but I do not have an option of using an ENC this time around. Thanks! Tony -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com . To post to this group, send email to puppet...@googlegroups.com . Visit this group at http://groups.google.com/group/puppet-users?hl=en . For more options, visit https://groups.google.com/groups/opt_out . -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en . For more options, visit https://groups.google.com/groups/opt_out . -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Sorry. I am mistaken on this “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes) ----- Original Message ----- From: "Dan White" <ygor@comcast.net> To: puppet-users@googlegroups.com Sent: Monday, April 8, 2013 1:56:53 PM Subject: Re: [Puppet Users] More Hiera and Environment questions I think the double-colon is the problem. In my hiera.yaml, I have :hierarchy: - %{environment}/%{hostname} - %{environment}/common - %{hostname} - common And it works “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes) ----- Original Message ----- From: "Tony C" <tonyjchong@gmail.com> To: puppet-users@googlegroups.com Sent: Monday, April 8, 2013 1:40:45 PM Subject: Re: [Puppet Users] More Hiera and Environment questions Oops, I copied and pasted the wrong thing. hiera.yaml :yaml: :datadir: /etc/puppetlabs/hieradata/%{::environment} :hierarchy: - common - %{::application} On my agent puppet.conf, I have tried what you suggested already but it can''t find the value in hiera. [agent] certname = xxxxxxxxxx server = xxxxxxxxxx report = true classfile = $vardir/classes.txt localconfig = $vardir/localconfig graph = true pluginsync = true environment = dev application = app_1 On Monday, April 8, 2013 10:33:26 AM UTC-7, Ygor wrote: http://docs.puppetlabs.com/guides/environment.html#on-the-agent-node I put it in the [agent] block of puppet.conf “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes) From: "Tony C" < tonyj...@gmail.com > To: puppet...@googlegroups.com Sent: Monday, April 8, 2013 1:28:37 PM Subject: [Puppet Users] More Hiera and Environment questions Hi everyone, I have a question that I can''t seem to find a solution to. I am using hiera, and having a hard time understanding how to pass environments for dynamic look ups. For example, if my hiera.yaml looks like this: :hierarchy: - %{::environment} - common How / where do I pass the $environment variable that the host will know it''s in a particular environment. I had something working before using an ENC, but I do not have an option of using an ENC this time around. Thanks! Tony -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com . To post to this group, send email to puppet...@googlegroups.com . Visit this group at http://groups.google.com/group/puppet-users?hl=en . For more options, visit https://groups.google.com/groups/opt_out . -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en . For more options, visit https://groups.google.com/groups/opt_out . -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en . For more options, visit https://groups.google.com/groups/opt_out . -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Yes, the double colon was a problem, also it looks like in the agent conf, this does not work applicaton = app_1 So this goes back to my original issue. Without an ENC, how can I ''tag" my machines with specific info. I was playing with custom facts but it looks like the same facts get applied to every node. Thanks! Tony -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
I must retract my earlier claim. I tried mine with and without the scoping double-colon and it works both ways. The documentation ( http://docs.puppetlabs.com/hiera/1/variables.html ) uses the double-colon. HOWEVER, I think (again) I see your problem: What is "application" ? All the variables I use are in the settings ( http://docs.puppetlabs.com/references/latest/configuration.html ) "application" is not a setting. “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes) ----- Original Message ----- From: "Tony C" <tonyjchong@gmail.com> To: puppet-users@googlegroups.com Sent: Monday, April 8, 2013 2:04:05 PM Subject: Re: [Puppet Users] More Hiera and Environment questions Yes, the double colon was a problem, also it looks like in the agent conf, this does not work applicaton = app_1 So this goes back to my original issue. Without an ENC, how can I ''tag" my machines with specific info. I was playing with custom facts but it looks like the same facts get applied to every node. Thanks! Tony -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en . For more options, visit https://groups.google.com/groups/opt_out . -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Thank you so much. I have never seen that page before. I think my issue is resolved for now. I''ll open another post for facts. On Monday, April 8, 2013 11:11:18 AM UTC-7, Ygor wrote:> > I must retract my earlier claim. > I tried mine with and without the scoping double-colon and it works both > ways. > > The documentation ( http://docs.puppetlabs.com/hiera/1/variables.html ) > uses the double-colon. > > HOWEVER, I think (again) I see your problem: What is "application" ? > > All the variables I use are in the settings ( > http://docs.puppetlabs.com/references/latest/configuration.html ) > > "application" is not a setting. > > “Sometimes I think the surest sign that intelligent life exists elsewhere > in the universe is that none of it has tried to contact us.” > Bill Waterson (Calvin & Hobbes) > > ------------------------------ > *From: *"Tony C" <tonyj...@gmail.com <javascript:>> > *To: *puppet...@googlegroups.com <javascript:> > *Sent: *Monday, April 8, 2013 2:04:05 PM > *Subject: *Re: [Puppet Users] More Hiera and Environment questions > > Yes, the double colon was a problem, also it looks like in the agent conf, > this does not work > applicaton = app_1 > > So this goes back to my original issue. Without an ENC, how can I ''tag" my > machines with specific info. I was playing with custom facts but it looks > like the same facts get applied to every node. > > Thanks! > > Tony > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-users...@googlegroups.com <javascript:>. > To post to this group, send email to puppet...@googlegroups.com<javascript:> > . > Visit this group at http://groups.google.com/group/puppet-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.