Data like this should probably go into hiera. Then write modules to
use the data via parameterized classes or hiera() lookups. For
example we use the "datadir" directive in hiera to split out hiera
lookups to become environments aware. This would simplify your data
structure to where you are just specifying the data for each
environment to use instead of having to code your manifests to
understand the data structure in a environmentally aware state.
Example in your prod environment hiera yaml:
software::soft1::version: 0.0.6
Example in your test environment hiera yaml:
software::soft1::version: 0.0.7
Then in your class:
class software::soft1($version) {
package { 'soft1':
ensure => $version
}
Hiera would give your puppet clients the correct answer based on environment...
However if you just want to use your data structure you referenced
above you can place it into a module/class or even use import. However
importing in a file like site.pp is not really recommended for various
reasons.
On Fri, Oct 4, 2013 at 10:52 AM, kay kay <[email protected]> wrote:
> I would like to create one file with array, i.e.:
>
> $pkg_versions = {
> soft1 => { prod => "0.0.6", test => "0.0.7" },
> soft2 => { prod => "1.1.4", test => "1.1.5" };
> }
>
> And "require" this file in several environments.
>
> I tried to use "require /var/lib/puppet/somedir/etc/file.inc", but puppet
> can not find it.
>
> What solution should I use? Or maybe is it possible to put this array in
> puppet class, include it in parent classe and get its values?
>
> Thanks for help!
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/puppet-users.
> For more options, visit https://groups.google.com/groups/opt_out.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.