members of collected resources

9 views
Skip to first unread message

Adam Heinz

unread,
Jun 12, 2012, 5:57:13 PM6/12/12
to puppet...@googlegroups.com
Is it possible to get the value of a member variable on a collected resource?  Something like

    Host <<| name == 'nagios' |>>
    $nagiosip = Host["nagios"]::ip

Gepetto has red lined all of my guesses so far.

jcbollinger

unread,
Jun 13, 2012, 9:37:40 AM6/13/12
to puppet...@googlegroups.com

Generally speaking, it is not possible to get the value of any property of any previously-declared resource from within your manifests.  There may be some kind of workaround involving inline templates or Ruby DSL, but only because they cannot do their jobs without opening a window to parts of Puppet that manifests are not intended to twiddle.

I would recommend instead recording host 'nagios''s IP in a class variable or an external data file, and having other nodes retrieve it from there.


John

Adam Heinz

unread,
Jun 13, 2012, 1:09:54 PM6/13/12
to puppet...@googlegroups.com
On Wed, Jun 13, 2012 at 9:37 AM, jcbollinger <John.Bo...@stjude.org> wrote:
I would recommend instead recording host 'nagios''s IP in a class variable or an external data file, and having other nodes retrieve it from there.

Yeah, I put it in my ENC as a global variable.  Not very elegant, but it works.
Reply all
Reply to author
Forward
0 new messages