[Puppet Users] Re: Trying to get complex data set into Puppet from ENC

2012-12-20 Thread Luke Bigum
Hi Jared,

On Wednesday, May 23, 2012 1:10:21 AM UTC+1, Jared Ballou wrote:

> Hi everyone, 
>
> I've been reading the groups here for a while, and have gotten a lot 
> of things fixed by finding other people's posts, so hopefully someone 
> will be able to set me straight. I am working on a Puppet deployment 
> that needs to have a lot of disparate data pulled together, and as far 
> as the ENC I created to pull it all in, everything has worked great. 
> However, I'm running into a problem instantiating Apache virtual 
> hosts. Here is some abridged output from my ENC: 
> --- 
> classes: 
>   app::lamp: 
> appdata: 
>   sites: 
> Some Website: 
>   id: "2" 
>   name: Some Website 
>   servername: somewebsite.com 
>   svntag_prod: trunk 
>   svntag_dev: trunk 
>   documentroot: ~ 
> Another Website: 
>   id: "4" 
>   name: Another Website 
>   servername: anotherwebsite.com 
>   svntag_prod: "1.2.0" 
>   svntag_dev: "1.3.0-rc4" 
>   documentroot: ~ 
> Third Website: 
>   id: "6" 
>   name: Third Website 
>   servername: thirdwebsite.com 
>   svntag_prod: trunk 
>   svntag_dev: trunk 
>   documentroot: "/opt/thirdwebsite/customhtdocs" 
>
> So, I have some other classes that are parameterized and I can 
> reference $appdata[$key] inside those manifests and everything works 
> fine for strings or arrays. My issue is getting this hash of hashes in 
> [appdata][sites] turned into vhosts. I tried using create_resources to 
> no avail,


I use create_resources() a bit with hash data pulled from Hiera and don't 
have too many problems with it (despite it's annoyingly vague error 
messages). Do you have an example of where it has not worked for you? I 
would have thought:

create_resources('apache::vhost', $appdata[$key][$sites])

should work fine, though I don't have an ENC so I'm not sure exactly how 
this data gets presented to you - it is a Puppet hash, right?
 

> tried dumping the ENC to YAML and using Hiera to parse that, 
> and I have struck out in every way. And, honestly, I think there must 
> be a better way to do this. The data is all in a single MySQL table, 
> so I looked at hiera-mysql backend, but I think I am over my head 
> here. Has anyone got a good example I could reference doing something 
> like this, especially for multi-dimensional hashes? I was starting to 
> look at just converting it to JSON or just comma delimited text and 
> feed it to Puppet as a string to be parsed, but that just seems wrong. 
> I've been at this 4 hours now with no luck, any help anyone can 
> provide would be greatly appreciated. 
>
> Thanks, 
>
> -Jared

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/vXuy7hRZeCkJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Trying to get complex data set into Puppet from ENC

2012-12-20 Thread Danie van Zyl
I'm having the same problem.

On Wednesday, 23 May 2012 02:10:21 UTC+2, Jared Ballou wrote:
>
> Hi everyone, 
>
> I've been reading the groups here for a while, and have gotten a lot 
> of things fixed by finding other people's posts, so hopefully someone 
> will be able to set me straight. I am working on a Puppet deployment 
> that needs to have a lot of disparate data pulled together, and as far 
> as the ENC I created to pull it all in, everything has worked great. 
> However, I'm running into a problem instantiating Apache virtual 
> hosts. Here is some abridged output from my ENC: 
> --- 
> classes: 
>   app::lamp: 
> appdata: 
>   sites: 
> Some Website: 
>   id: "2" 
>   name: Some Website 
>   servername: somewebsite.com 
>   svntag_prod: trunk 
>   svntag_dev: trunk 
>   documentroot: ~ 
> Another Website: 
>   id: "4" 
>   name: Another Website 
>   servername: anotherwebsite.com 
>   svntag_prod: "1.2.0" 
>   svntag_dev: "1.3.0-rc4" 
>   documentroot: ~ 
> Third Website: 
>   id: "6" 
>   name: Third Website 
>   servername: thirdwebsite.com 
>   svntag_prod: trunk 
>   svntag_dev: trunk 
>   documentroot: "/opt/thirdwebsite/customhtdocs" 
>
> So, I have some other classes that are parameterized and I can 
> reference $appdata[$key] inside those manifests and everything works 
> fine for strings or arrays. My issue is getting this hash of hashes in 
> [appdata][sites] turned into vhosts. I tried using create_resources to 
> no avail, tried dumping the ENC to YAML and using Hiera to parse that, 
> and I have struck out in every way. And, honestly, I think there must 
> be a better way to do this. The data is all in a single MySQL table, 
> so I looked at hiera-mysql backend, but I think I am over my head 
> here. Has anyone got a good example I could reference doing something 
> like this, especially for multi-dimensional hashes? I was starting to 
> look at just converting it to JSON or just comma delimited text and 
> feed it to Puppet as a string to be parsed, but that just seems wrong. 
> I've been at this 4 hours now with no luck, any help anyone can 
> provide would be greatly appreciated. 
>
> Thanks, 
>
> -Jared

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/ZdBvHpmNeFAJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.