FAQ
Hi! I am using environments in my puppet setup, and would like to do the
same for hiera. I used to have this sort of hierarchy:
:hierarchy: - hosts/%{fqdn}
- domain/%{domain}
- whatever/%{some_fact}
- common

with a yaml datadir:
:yaml:
:datadir: - /etc/puppetlabs/puppet/hieradata

I would like to append %{environment} to my datadir in order to get
separation, however it looks like I can't and will have to do this:
:hierarchy: - %{environment}/hosts/%{fqdn}
- %{environment}/domain/%{domain}
- %{environment}/whatever/%{some_fact}
- %{environment}/common

Can anyone verify that appending %{environment} to datadir won't work?
Does anyone have a good way of separating hiera environments?

Thanks a lot!
Guy

--
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.

Search Discussions

  • Ramin K at May 2, 2012 at 9:03 pm

    On 5/2/2012 1:57 PM, Guy Matz wrote:
    Hi! I am using environments in my puppet setup, and would like to do
    the same for hiera. I used to have this sort of hierarchy:
    :hierarchy: - hosts/%{fqdn}
    - domain/%{domain}
    - whatever/%{some_fact}
    - common

    with a yaml datadir:
    :yaml:
    :datadir: - /etc/puppetlabs/puppet/hieradata

    I would like to append %{environment} to my datadir in order to get
    separation, however it looks like I can't and will have to do this:
    :hierarchy: - %{environment}/hosts/%{fqdn}
    - %{environment}/domain/%{domain}
    - %{environment}/whatever/%{some_fact}
    - %{environment}/common

    Can anyone verify that appending %{environment} to datadir won't work?
    Does anyone have a good way of separating hiera environments?

    Thanks a lot!
    Guy
    I'm using the following which I copied from somewhere. Quotes might be
    part of the missing magic. Also I'm not sure you'd want a - in there
    either.

    :yaml:
    :datadir: '/home/puppet/environments/%{environment}/hieradata'

    Ramin

    --
    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.
  • Gary Larizza at May 2, 2012 at 9:16 pm

    On Wed, May 2, 2012 at 2:03 PM, Ramin K wrote:
    On 5/2/2012 1:57 PM, Guy Matz wrote:

    Hi! I am using environments in my puppet setup, and would like to do
    the same for hiera. I used to have this sort of hierarchy:
    :hierarchy: - hosts/%{fqdn}
    - domain/%{domain}
    - whatever/%{some_fact}
    - common

    with a yaml datadir:
    :yaml:
    :datadir: - /etc/puppetlabs/puppet/**hieradata

    I would like to append %{environment} to my datadir in order to get
    separation, however it looks like I can't and will have to do this:
    :hierarchy: - %{environment}/hosts/%{fqdn}
    - %{environment}/domain/%{**domain}
    - %{environment}/whatever/%{**some_fact}
    - %{environment}/common

    Can anyone verify that appending %{environment} to datadir won't work?
    Does anyone have a good way of separating hiera environments?

    Thanks a lot!
    Guy
    I'm using the following which I copied from somewhere. Quotes might be
    part of the missing magic. Also I'm not sure you'd want a - in there either.

    :yaml:
    :datadir: '/home/puppet/environments/%{**environment}/hieradata'

    I would use double-quotes for string interpolation, but this should work.
    I've used this in a couple of on-site engagements, and it has worked well
    for us.




    Ramin


    --
    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 <puppet-users%2Bunsubscribe@googlegroups.com>.
    For more options, visit this group at http://groups.google.com/**
    group/puppet-users?hl=en<http://groups.google.com/group/puppet-users?hl=en>
    .

    --

    Gary Larizza
    Professional Services Engineer
    Puppet Labs

    --
    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.
  • Ramin K at May 2, 2012 at 9:52 pm

    On 5/2/2012 2:16 PM, Gary Larizza wrote:
    I'm using the following which I copied from somewhere. Quotes might
    be part of the missing magic. Also I'm not sure you'd want a - in
    there either.

    :yaml:
    :datadir: '/home/puppet/environments/%{environment}/hieradata'


    I would use double-quotes for string interpolation, but this should
    work. I've used this in a couple of on-site engagements, and it has
    worked well for us.
    I don't think this is correct. If it were, my config should not work at
    all. In this case single or double quotes should both work. It's my
    understanding that hiera.yaml is a data file that is going to be parsed
    and then consumed by Puppet where things like variable interpolation
    would happen. There isn't any variable interpolation during the parsing
    so single quotes are more correct.

    http://www.yaml.org/YAML_for_ruby.html#single-quoted_strings

    Ramin

    --
    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.
  • R.I.Pienaar at May 2, 2012 at 9:56 pm

    ----- Original Message -----
    From: "Ramin K" <ramin-list@badapple.net>
    To: puppet-users@googlegroups.com
    Sent: Wednesday, May 2, 2012 10:51:56 PM
    Subject: Re: [Puppet Users] hiera "environmentss" question
    On 5/2/2012 2:16 PM, Gary Larizza wrote:
    I'm using the following which I copied from somewhere. Quotes
    might
    be part of the missing magic. Also I'm not sure you'd want a -
    in
    there either.

    :yaml:
    :datadir:
    '/home/puppet/environments/%{environment}/hieradata'


    I would use double-quotes for string interpolation, but this should
    work. I've used this in a couple of on-site engagements, and it
    has
    worked well for us.
    I don't think this is correct. If it were, my config should not work
    at all. In this case single or double quotes should both work. It's my
    understanding that hiera.yaml is a data file that is going to be
    parsed and then consumed by Puppet where things like variable interpolation
    would happen. There isn't any variable interpolation during the
    parsing so single quotes are more correct.
    that's correct yeah

    --
    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.
  • Gary Larizza at May 2, 2012 at 10:59 pm

    On Wed, May 2, 2012 at 2:51 PM, Ramin K wrote:
    On 5/2/2012 2:16 PM, Gary Larizza wrote:

    I'm using the following which I copied from somewhere. Quotes might
    be part of the missing magic. Also I'm not sure you'd want a - in
    there either.

    :yaml:
    :datadir: '/home/puppet/environments/%{**environment}/hieradata'


    I would use double-quotes for string interpolation, but this should
    work. I've used this in a couple of on-site engagements, and it has
    worked well for us.
    I don't think this is correct. If it were, my config should not
    work at all. In this case single or double quotes should both work. It's my
    understanding that hiera.yaml is a data file that is going to be parsed and
    then consumed by Puppet where things like variable interpolation would
    happen. There isn't any variable interpolation during the parsing so single
    quotes are more correct.

    http://www.yaml.org/YAML_for_**ruby.html#single-quoted_**strings<http://www.yaml.org/YAML_for_ruby.html#single-quoted_strings>
    Yep, like RI said you're totally correct here. Thanks for correcting :)


    Ramin

    --
    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 <puppet-users%2Bunsubscribe@googlegroups.com>.
    For more options, visit this group at http://groups.google.com/**
    group/puppet-users?hl=en<http://groups.google.com/group/puppet-users?hl=en>
    .

    --

    Gary Larizza
    Professional Services Engineer
    Puppet Labs

    --
    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.
  • Guy Matz at May 3, 2012 at 4:45 pm
    Hmmm . . anyone have any idea why environment would not be getting
    interpolated?
    Cannot find datafile
    /etc/puppetlabs/puppet/%{environment}/hieradata/10-host/gmatzpupnode.yaml

    I have the following in my node's puppet.conf [agent] section:
    environment = default

    thanks again,
    Guy
    On Wed, May 2, 2012 at 6:59 PM, Gary Larizza wrote:


    On Wed, May 2, 2012 at 2:51 PM, Ramin K wrote:
    On 5/2/2012 2:16 PM, Gary Larizza wrote:

    I'm using the following which I copied from somewhere. Quotes might
    be part of the missing magic. Also I'm not sure you'd want a - in
    there either.

    :yaml:
    :datadir: '/home/puppet/environments/%{**environment}/hieradata'


    I would use double-quotes for string interpolation, but this should
    work. I've used this in a couple of on-site engagements, and it has
    worked well for us.
    I don't think this is correct. If it were, my config should not
    work at all. In this case single or double quotes should both work. It's my
    understanding that hiera.yaml is a data file that is going to be parsed and
    then consumed by Puppet where things like variable interpolation would
    happen. There isn't any variable interpolation during the parsing so single
    quotes are more correct.

    http://www.yaml.org/YAML_for_**ruby.html#single-quoted_**strings<http://www.yaml.org/YAML_for_ruby.html#single-quoted_strings>
    Yep, like RI said you're totally correct here. Thanks for correcting :)


    Ramin

    --
    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 <puppet-users%2Bunsubscribe@googlegroups.com>.
    For more options, visit this group at http://groups.google.com/**
    group/puppet-users?hl=en<http://groups.google.com/group/puppet-users?hl=en>
    .

    --

    Gary Larizza
    Professional Services Engineer
    Puppet Labs

    --
    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.
  • Ramin K at May 3, 2012 at 5:51 pm

    On 5/3/2012 9:45 AM, Guy Matz wrote:
    Hmmm . . anyone have any idea why environment would not be getting
    interpolated?
    Cannot find datafile
    /etc/puppetlabs/puppet/%{environment}/hieradata/10-host/gmatzpupnode.yaml

    I have the following in my node's puppet.conf [agent] section:
    environment = default

    thanks again,
    Guy
    I see a few possible problems. Have you configured a default environment
    on the Puppet master? Puppet uses the environment 'production' when
    nothing is set. Also does ./puppet/default/hieradata/ exist and are the
    the rest of the paths correct based on what you've set in your hiera.yaml?

    Ramin






    --
    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.
  • Marek Dohojda at May 2, 2012 at 9:23 pm
    I can attest to the fact that it works fine here is my:

    :yaml:
    :datadir: '/etc/puppet/env/%{environment}/hieradata'

    I am having no issues with that.

    On Wed, May 2, 2012 at 2:57 PM, Guy Matz wrote:

    Hi! I am using environments in my puppet setup, and would like to do the
    same for hiera. I used to have this sort of hierarchy:
    :hierarchy: - hosts/%{fqdn}
    - domain/%{domain}
    - whatever/%{some_fact}
    - common

    with a yaml datadir:
    :yaml:
    :datadir: - /etc/puppetlabs/puppet/hieradata

    I would like to append %{environment} to my datadir in order to get
    separation, however it looks like I can't and will have to do this:
    :hierarchy: - %{environment}/hosts/%{fqdn}
    - %{environment}/domain/%{domain}
    - %{environment}/whatever/%{some_fact}
    - %{environment}/common

    Can anyone verify that appending %{environment} to datadir won't work?
    Does anyone have a good way of separating hiera environments?

    Thanks a lot!
    Guy

    --
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedMay 2, '12 at 8:57p
activeMay 3, '12 at 5:51p
posts9
users5
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase