FAQ
Hi all,
So, I am trying to use Hiera in combination with a glusterfs module
from https://forge.puppetlabs.com/thias/glusterfs.
What I'd like to be able to do is, in node specific files, define something
like
glusternode:
- host: gluster1.blah
- ip: 1.2.3.4
in gluster1.blah.yaml

I'm populating a puppet class call that looks like this:
class { 'glusterfs::server': peers => $::hostname ? { 'server1' =>
'192.168.0.2', 'server2' => '192.168.0.1', }, }

What I'd then want to do would be assemble all of the data from each hiera
node specific config file into a hash I can pass to puppet listing all my
hosts. Is there any way to do this? I suppose another way to say it is that
from the root, I want to pull specific data off all of the leaves and pass
all that data on to puppet.

I want to essentially do this for in my declaration:
class { 'glusterfs::server': peers => $::hostname ? {
hiera(glusternodes) }, }
Any ideas?
Thanks!
-Josh

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

Search Discussions

  • Ellison Marks at Mar 12, 2013 at 12:44 am
    I think what you're describing fits exported resources. That is, each node
    would get it's data from hiera and export it, and then the main node would
    spaceship it all up.

    http://docs.puppetlabs.com/puppet/3/reference/lang_exported.html
    http://docs.puppetlabs.com/guides/exported_resources.html
    On Monday, March 11, 2013 2:52:52 PM UTC-7, Josh Harrison wrote:

    Hi all,
    So, I am trying to use Hiera in combination with a glusterfs module from
    https://forge.puppetlabs.com/thias/glusterfs.
    What I'd like to be able to do is, in node specific files, define
    something like
    glusternode:
    - host: gluster1.blah
    - ip: 1.2.3.4
    in gluster1.blah.yaml

    I'm populating a puppet class call that looks like this:
    class { 'glusterfs::server': peers => $::hostname ? { 'server1' =>
    '192.168.0.2', 'server2' => '192.168.0.1', }, }

    What I'd then want to do would be assemble all of the data from each hiera
    node specific config file into a hash I can pass to puppet listing all my
    hosts. Is there any way to do this? I suppose another way to say it is that
    from the root, I want to pull specific data off all of the leaves and pass
    all that data on to puppet.

    I want to essentially do this for in my declaration:
    class { 'glusterfs::server': peers => $::hostname ? {
    hiera(glusternodes) }, }
    Any ideas?
    Thanks!
    -Josh
    --
    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.
  • Jcbollinger at Mar 12, 2013 at 1:38 pm

    On Monday, March 11, 2013 7:44:08 PM UTC-5, Ellison Marks wrote:
    I think what you're describing fits exported resources. That is, each node
    would get it's data from hiera and export it, and then the main node would
    spaceship it all up.

    http://docs.puppetlabs.com/puppet/3/reference/lang_exported.html
    http://docs.puppetlabs.com/guides/exported_resources.html

    Possibly, though that's not an exact fit to the concept the OP described.
    One needs to remember that its *resources* that can be exported, not raw
    data.

    I think the OP has his plan backwards. Given that he has a need for a hash
    of all the per-node data, I don't understand why he wants to spread it out
    over separate per-node files and then make Puppet reassemble it. I would
    express the whole master hash in a common hiera data file, and have each
    node select its own data out of that.

    With that said, it looks like the OP is also confused by the similarity
    between Puppet's hash literal syntax and its selector syntax.
    Specifically, the expression

    $::hostname ? { 'server1' => '192.168.0.2', 'server2' => '192.168.0.1', },

    does not involve a Puppet hash. If one did had a hash of the server name
    to IP mappings, then the syntax for selecting a desired element from it
    would be different:

    $my_hash[$::hostname]

    John

    --
    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.
  • Josh Harrison at Mar 13, 2013 at 10:21 pm
    Great thank you both.
    On Tuesday, March 12, 2013 6:38:37 AM UTC-7, jcbollinger wrote:


    On Monday, March 11, 2013 7:44:08 PM UTC-5, Ellison Marks wrote:

    I think what you're describing fits exported resources. That is, each
    node would get it's data from hiera and export it, and then the main node
    would spaceship it all up.

    http://docs.puppetlabs.com/puppet/3/reference/lang_exported.html
    http://docs.puppetlabs.com/guides/exported_resources.html

    Possibly, though that's not an exact fit to the concept the OP described.
    One needs to remember that its *resources* that can be exported, not raw
    data.

    I think the OP has his plan backwards. Given that he has a need for a
    hash of all the per-node data, I don't understand why he wants to spread it
    out over separate per-node files and then make Puppet reassemble it. I
    would express the whole master hash in a common hiera data file, and have
    each node select its own data out of that.

    With that said, it looks like the OP is also confused by the similarity
    between Puppet's hash literal syntax and its selector syntax.
    Specifically, the expression

    $::hostname ? { 'server1' => '192.168.0.2', 'server2' => '192.168.0.1', },

    does not involve a Puppet hash. If one did had a hash of the server name
    to IP mappings, then the syntax for selecting a desired element from it
    would be different:

    $my_hash[$::hostname]

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedMar 11, '13 at 9:54p
activeMar 13, '13 at 10:21p
posts4
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2021 Grokbase