I recently faced the same challenge. I did not want to group by osfamily but by another fact. I came up with this solution: 1) retrieve a list from PuppetDB in format 'nodename:factvalue' for all nodes using puppetdbquery on a puppetmaster (sudo puppet query facts --facts=<factname> "<some query that resolved to true>") 2) retrieve the group list from the console with 'rake nodegroup:list' 3) Compare the existing groups with the groups based upon the values from the fact and create missing groups with 'nodegroup:add[groupname] 4) For each (already) existing group, get all members of the group with 'nodegroup:group_list[groupname]' 5) Compare the nodenames that are already in the group with the list of nodenames from PuppetDB, and add missing nodes of a group with node:group[nodename,<standardgroup>:<groupname>]
I came to this solution because rake calls felt relatively slow (about 7 seconds per call) on our platform and I wanted it to be able to potentially scale to thousands of nodes. This runs once a night from an old fashioned cron. Richard On Monday, January 27, 2014 3:16:09 PM UTC+1, kaustubh chaudhari wrote: > > Hi, > > I was looking for a way to group the servers dynamically. Eg: create a > "Windows" Group and all the existing nodes and new nodes should be part of > "Windows" group. > I edit a group and then add each server, but practically its not possible > with 2k servers in all!! > > Is there a way to do that? > > -Kaustubh > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/264ebf83-877d-47f6-851e-44dac62a8d9a%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
