Ask Your Question
1

accessing variables declared in an "each" from other classes

asked 2014-08-15 10:01:00 -0500

Hi!

I want to ask, how other puppet user manage my problem.

I've a module "website" with websites declared in my hiera .yaml now I loop through these websites with:

        $website::website_values.each |$site, $values| { something }

ok so far. In my website::example I auto create some databases for these websites over the mysql_db provider and other things. there I've the $databasename, $password etc

now I've website::profile where I create the .profile file for the users (website name = user name). This file should contain the databasename and password. (yes, my question will follow soon!)

do I have to copy/paste the code from website::example to get this variable values from the website::example each? or is there another way to "export" them? (for example with facts) what is best practice?

Cheers

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2014-08-26 13:47:32 -0500

WhatsARanjit gravatar image

You'll want to outline your websites resources in hiera and probably use the create_resources function to create them all in one go. You can also use a defaults hash if they pretty much have the same settings.

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

2 followers

Stats

Asked: 2014-08-15 10:01:00 -0500

Seen: 147 times

Last updated: Aug 26 '14