Ask Your Question
0

Possible to singularly define resources then collect in array?

asked 2013-11-19 11:36:36 -0500

tlambertx gravatar image

I am looking to define multiple resources singularly (for portability) then "collect" attributes of those resources in an array to populate a config file via an ERB template. The goal is not having to declare the same thing twice for two separate classes/definitions which use the exact same values, just in a different way. Is it possible to declare two resources ('res1' and 'res2') and then create an array with those names (or other specific attributes) to use in an ERB template. For example, here is a broken view of what I'm trying to accomplish:

manifests/nodes/node ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-12-20 09:08:14 -0500

ffrank gravatar image

I don't believe that this is possible the way you'd like to design it.

A good way to go about it would be to use hashes after all. Note that hiera needs not be the data source for those, and a flexible module will leave the choice to the user.

Once the input data is available in a hash, you can do this in the module's manifest:

create_resources("my::resource", $hash_data)

The template can consume the same data.

It's a limitation that the hash will need to be passed to a single interface of the module ... (more)

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-11-19 11:36:36 -0500

Seen: 272 times

Last updated: Dec 20 '13