FAQ
Hi list,

I wondered if I could include 'dynamic' data inside a hiera yaml file. I
would like to be able to add variables in scope of the resource which
performs a hiera call. So e.g.

in hiera yaml:

address: "192.168.1.#{nodeID}"

in puppet

node test {

$nodeID = 5

$ip=hiera(address)

}


Is such thing possible and if so what is the correct syntax?

thanks

Peter

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • R.I.Pienaar at Oct 17, 2012 at 2:37 pm

    ----- Original Message -----
    From: "Peter De Cleyn" <[email protected]>
    To: [email protected]
    Sent: Wednesday, October 17, 2012 3:24:30 PM
    Subject: [Puppet Users] dynamic data in hiera

    Hi list,

    I wondered if I could include 'dynamic' data inside a hiera yaml
    file. I would like to be able to add variables in scope of the
    resource which performs a hiera call. So e.g.

    in hiera yaml:

    address: "192.168.1.#{nodeID}"
    try %{nodeID}

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to [email protected].
    To unsubscribe from this group, send email to [email protected].
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Pdcleyn at Oct 17, 2012 at 2:54 pm
    thx! that works!

    However, in testing just now I bumped against something strange. When I add
    %{$nodeID} (which I should not), the CPU usage of the puppet master shoots
    to 100% and stays there. The client will eventually time out (execution
    expired) and the puppet master keeps burning CPU cycles. This is a test
    setup up, so no other nodes are connected but one and it is quite
    reproducable on this setup. Is this a known issue?

    Peter


    Op woensdag 17 oktober 2012 16:30:03 UTC+2 schreef R.I. Pienaar het
    volgende:

    ----- Original Message -----
    From: "Peter De Cleyn" <[email protected] <javascript:>>
    To: [email protected] <javascript:>
    Sent: Wednesday, October 17, 2012 3:24:30 PM
    Subject: [Puppet Users] dynamic data in hiera

    Hi list,

    I wondered if I could include 'dynamic' data inside a hiera yaml
    file. I would like to be able to add variables in scope of the
    resource which performs a hiera call. So e.g.

    in hiera yaml:

    address: "192.168.1.#{nodeID}"
    try %{nodeID}
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/uoayA6QJge8J.
    To post to this group, send email to [email protected].
    To unsubscribe from this group, send email to [email protected].
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Douglas Brancaglion at Oct 18, 2012 at 12:52 am
    i have the same problem with cpu...

    You are using stororeconfigs?

    Douglas Brancaglion
    2012/10/17 pdcleyn <[email protected]>
    thx! that works!

    However, in testing just now I bumped against something strange. When I
    add %{$nodeID} (which I should not), the CPU usage of the puppet master
    shoots to 100% and stays there. The client will eventually time out
    (execution expired) and the puppet master keeps burning CPU cycles. This is
    a test setup up, so no other nodes are connected but one and it is quite
    reproducable on this setup. Is this a known issue?

    Peter


    Op woensdag 17 oktober 2012 16:30:03 UTC+2 schreef R.I. Pienaar het
    volgende:
    ----- Original Message -----
    From: "Peter De Cleyn" <[email protected]>
    To: [email protected]
    Sent: Wednesday, October 17, 2012 3:24:30 PM
    Subject: [Puppet Users] dynamic data in hiera

    Hi list,

    I wondered if I could include 'dynamic' data inside a hiera yaml
    file. I would like to be able to add variables in scope of the
    resource which performs a hiera call. So e.g.

    in hiera yaml:

    address: "192.168.1.#{nodeID}"
    try %{nodeID}
    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/puppet-users/-/uoayA6QJge8J.

    To post to this group, send email to [email protected].
    To unsubscribe from this group, send email to
    [email protected].
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.


    --
    Douglas Brancaglion
    Security Analist

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to [email protected].
    To unsubscribe from this group, send email to [email protected].
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Peter De Cleyn at Oct 17, 2012 at 9:54 pm
    No, just plain manifests and hiera yaml files.

    Peter
    On 17 Oct 2012, at 19:36, Douglas Brancaglion wrote:

    i have the same problem with cpu...

    You are using stororeconfigs?

    Douglas Brancaglion
    2012/10/17 pdcleyn <[email protected]>
    thx! that works!

    However, in testing just now I bumped against something strange. When I add %{$nodeID} (which I should not), the CPU usage of the puppet master shoots to 100% and stays there. The client will eventually time out (execution expired) and the puppet master keeps burning CPU cycles. This is a test setup up, so no other nodes are connected but one and it is quite reproducable on this setup. Is this a known issue?

    Peter


    Op woensdag 17 oktober 2012 16:30:03 UTC+2 schreef R.I. Pienaar het volgende:

    ----- Original Message -----
    From: "Peter De Cleyn" <[email protected]>
    To: [email protected]
    Sent: Wednesday, October 17, 2012 3:24:30 PM
    Subject: [Puppet Users] dynamic data in hiera

    Hi list,

    I wondered if I could include 'dynamic' data inside a hiera yaml
    file. I would like to be able to add variables in scope of the
    resource which performs a hiera call. So e.g.

    in hiera yaml:

    address: "192.168.1.#{nodeID}"
    try %{nodeID}
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/uoayA6QJge8J.

    To post to this group, send email to [email protected].
    To unsubscribe from this group, send email to [email protected].
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.



    --
    Douglas Brancaglion
    Security Analist

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to [email protected].
    To unsubscribe from this group, send email to [email protected].
    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 [email protected].
    To unsubscribe from this group, send email to [email protected].
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Peter De Cleyn at Oct 18, 2012 at 7:44 pm
    For further reference: I found the problem with the CPU burning. It seems
    hiera lookups can end up in an endless loop when specifying meaningful
    regex characters (like $,+,?) in your lookup variables.

    So specifying key:%{$var} will cause an endless loop. I created a ticket
    http://projects.puppetlabs.com/issues/17094 to address the issue and
    suggested a possible fix (using Regexp.escape) .

    Otherwise, hiera is a great tool to work with! Such a level of flexibility
    you add to your puppet environment!

    Peter
    On Wed, Oct 17, 2012 at 11:54 PM, Peter De Cleyn wrote:

    No, just plain manifests and hiera yaml files.

    Peter


    On 17 Oct 2012, at 19:36, Douglas Brancaglion wrote:

    i have the same problem with cpu...

    You are using stororeconfigs?

    Douglas Brancaglion
    2012/10/17 pdcleyn <[email protected]>
    thx! that works!

    However, in testing just now I bumped against something strange. When I
    add %{$nodeID} (which I should not), the CPU usage of the puppet master
    shoots to 100% and stays there. The client will eventually time out
    (execution expired) and the puppet master keeps burning CPU cycles. This is
    a test setup up, so no other nodes are connected but one and it is quite
    reproducable on this setup. Is this a known issue?

    Peter


    Op woensdag 17 oktober 2012 16:30:03 UTC+2 schreef R.I. Pienaar het
    volgende:
    ----- Original Message -----
    From: "Peter De Cleyn" <[email protected]>
    To: [email protected]
    Sent: Wednesday, October 17, 2012 3:24:30 PM
    Subject: [Puppet Users] dynamic data in hiera

    Hi list,

    I wondered if I could include 'dynamic' data inside a hiera yaml
    file. I would like to be able to add variables in scope of the
    resource which performs a hiera call. So e.g.

    in hiera yaml:

    address: "192.168.1.#{nodeID}"
    try %{nodeID}
    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/puppet-users/-/uoayA6QJge8J.

    To post to this group, send email to [email protected].
    To unsubscribe from this group, send email to
    [email protected].
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.


    --
    Douglas Brancaglion
    Security Analist

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To post to this group, send email to [email protected].
    To unsubscribe from this group, send email to
    [email protected].
    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 [email protected].
    To unsubscribe from this group, send email to [email protected].
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Nick Fagerlund at Oct 18, 2012 at 11:24 pm

    On Thursday, October 18, 2012 11:39:05 AM UTC-7, pdcleyn wrote:
    ... endless loop when specifying meaningful regex characters (like $,+,?)
    in your lookup variables.

    Oh! That's probably exactly what happened when I was experimenting w/
    interpolating members of hash and array vars received from Puppet. (i.e.
    testvalue: %{myhash['some_key']} )

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/4jmQ_Rm5gd4J.
    To post to this group, send email to [email protected].
    To unsubscribe from this group, send email to [email protected].
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Peter De Cleyn at Oct 19, 2012 at 7:19 am
    To be sure, you can run the puppet master in debug mode: puppet master
    --no-daemonize --debug

    You will get a continuous stream of messages from hiera:

    Debug: hiera(): Looking up $sys in scope
    Debug: hiera(): Looking up $sys in scope
    Debug: hiera(): Looking up $sys in scope
    ...

    On Fri, Oct 19, 2012 at 1:16 AM, Nick Fagerlund wrote:

    On Thursday, October 18, 2012 11:39:05 AM UTC-7, pdcleyn wrote:

    ... endless loop when specifying meaningful regex characters (like $,+,?)
    in your lookup variables.

    Oh! That's probably exactly what happened when I was experimenting w/
    interpolating members of hash and array vars received from Puppet. (i.e.
    testvalue: %{myhash['some_key']} )

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/puppet-users/-/4jmQ_Rm5gd4J.

    To post to this group, send email to [email protected].
    To unsubscribe from this group, send email to
    [email protected].
    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 [email protected].
    To unsubscribe from this group, send email to [email protected].
    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
postedOct 17, '12 at 2:24p
activeOct 19, '12 at 7:19a
posts8
users5
websitepuppetlabs.com

People

Translate

site design / logo © 2023 Grokbase