Re: [Puppet Users] Is there any example to collect IPs of other nodes to generate a hash to be used in mysql_grant
If you use puppetdb you can use my puppetdbquery module: http://forge.puppetlabs.com/dalen/puppetdbquery You will get it as a array of IP addresses though. But should be easier to go from there at least. If you use the future parser it is fairly trivial to convert that to a hash, in the old parser such conversion requires a little more trickery, possibly with some of the stdlib functions. On 19 December 2013 01:55, Pan Luo luopa...@gmail.com wrote: Hi there, I'm trying to setup the permissions on mysql database with multiple web servers using puppet-mysql module. I would like to collect all IPs of the web servers and run grant on the database server. It seems exported resources might help. The only way I can think of right now is to export the file resources on each web node with IP as the content and collect them on the db node. Then I have to load those file content using a custom function. Then generate a hash from them that will be sent to mysql::server grants variable. Is there a easier way to do it? Thanks. -- 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 puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/bfe2880e-0f5c-4f6d-b65b-9e832f4f9510%40googlegroups.com . For more options, visit https://groups.google.com/groups/opt_out. -- Erik Dalén -- 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 puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAAAzDLec-W3JiByPR2V5UuRFpoof1t803mcUmPgfNDLJDrjfEQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Puppet Users] Is there any example to collect IPs of other nodes to generate a hash to be used in mysql_grant
Hi Erik, Thanks. I'm using your module right now and was able to get all IPs of the web servers into an array. I'm struggling to convert them into a hash. I'm using puppet 3.3.2, so I suppose it's future parser? Could you give me some light? The array I got is something like this: [ip1, ip2] The hash I would like to be convert to is: { ip1 = { attr1 = value1, attr2 = value2}, ip2 = { attr1 = value1, attr2 = value2} } Ideally if there is any function can merge an array and hash, e.g. merge( [ip1, ip2], { attr1 = value1, attr2 = value2}) to get above value. Thanks! Cheers, Pan On Thursday, December 19, 2013 4:54:37 AM UTC-8, Erik Dalén wrote: If you use puppetdb you can use my puppetdbquery module: http://forge.puppetlabs.com/dalen/puppetdbquery You will get it as a array of IP addresses though. But should be easier to go from there at least. If you use the future parser it is fairly trivial to convert that to a hash, in the old parser such conversion requires a little more trickery, possibly with some of the stdlib functions. On 19 December 2013 01:55, Pan Luo luop...@gmail.com javascript:wrote: Hi there, I'm trying to setup the permissions on mysql database with multiple web servers using puppet-mysql module. I would like to collect all IPs of the web servers and run grant on the database server. It seems exported resources might help. The only way I can think of right now is to export the file resources on each web node with IP as the content and collect them on the db node. Then I have to load those file content using a custom function. Then generate a hash from them that will be sent to mysql::server grants variable. Is there a easier way to do it? Thanks. -- 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 puppet-users...@googlegroups.com javascript:. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/bfe2880e-0f5c-4f6d-b65b-9e832f4f9510%40googlegroups.com . For more options, visit https://groups.google.com/groups/opt_out. -- Erik Dalén -- 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 puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/22c80f9f-a67d-4f43-8218-8f31d26789d2%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Puppet Users] Is there any example to collect IPs of other nodes to generate a hash to be used in mysql_grant
Never mind. Got it working with future parser. Here is the reference http://docs.puppetlabs.com/puppet/3/reference/experiments_lambdas.html, might help other people. On Thursday, December 19, 2013 3:52:34 PM UTC-8, Pan Luo wrote: Hi Erik, Thanks. I'm using your module right now and was able to get all IPs of the web servers into an array. I'm struggling to convert them into a hash. I'm using puppet 3.3.2, so I suppose it's future parser? Could you give me some light? The array I got is something like this: [ip1, ip2] The hash I would like to be convert to is: { ip1 = { attr1 = value1, attr2 = value2}, ip2 = { attr1 = value1, attr2 = value2} } Ideally if there is any function can merge an array and hash, e.g. merge( [ip1, ip2], { attr1 = value1, attr2 = value2}) to get above value. Thanks! Cheers, Pan On Thursday, December 19, 2013 4:54:37 AM UTC-8, Erik Dalén wrote: If you use puppetdb you can use my puppetdbquery module: http://forge.puppetlabs.com/dalen/puppetdbquery You will get it as a array of IP addresses though. But should be easier to go from there at least. If you use the future parser it is fairly trivial to convert that to a hash, in the old parser such conversion requires a little more trickery, possibly with some of the stdlib functions. On 19 December 2013 01:55, Pan Luo luop...@gmail.com wrote: Hi there, I'm trying to setup the permissions on mysql database with multiple web servers using puppet-mysql module. I would like to collect all IPs of the web servers and run grant on the database server. It seems exported resources might help. The only way I can think of right now is to export the file resources on each web node with IP as the content and collect them on the db node. Then I have to load those file content using a custom function. Then generate a hash from them that will be sent to mysql::server grants variable. Is there a easier way to do it? Thanks. -- 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 puppet-users...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/bfe2880e-0f5c-4f6d-b65b-9e832f4f9510%40googlegroups.com . For more options, visit https://groups.google.com/groups/opt_out. -- Erik Dalén -- 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 puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/97fd1f4d-6539-4daa-b7d5-cb020ecab0b0%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.