Ask Your Question
0

Is it possible to collect variable values from resources?

asked 2013-12-03 04:23:17 -0600

Vladimir-csp gravatar image

updated 2015-04-04 19:25:11 -0600

ramindk gravatar image

Hi! I would like to know, is it possible to collect variable values from a group of resources to use them in the template in another class? Or is there any other way to collect and reuse values from resources? Let's say, we have a configuration:

define site (var1 =  undef) {
      some code
}

class sites {
    site{"blabla.com":
         var1 => 'bla-1-bla',
    }
    site{"secondsite.com":
         var1 => 'some-other-value',
    }
}

Is it possible to generate the array that contains all var1 values of all 'site' resources, like ['bla-1-bla','some-other-value']?

edit retag flag offensive close merge delete

Comments

Since you specify them already in your class, then your codebase contains already everything you need. maybe go for an external facts which parses the manifests and constructs the array.

far4d gravatar imagefar4d ( 2015-06-14 01:52:18 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-06-12 07:11:20 -0600

sinned gravatar image

You could of course uses a hiera database backend which you populate with your individual ressource data.

Then you create a view in the database which does the collection and then you reuse that again using hiera in your puppet code.

This is just a scheme of the way I would look into.

edit flag offensive delete link more
0

answered 2015-04-04 10:53:40 -0600

updated 2016-08-15 20:35:00 -0600

No, it is not.

Edit 2016-08: With the future parser and a lambda it is.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-12-03 04:23:17 -0600

Seen: 350 times

Last updated: Aug 15 '16