Hi, are there any good ways of scripting an inventory of managed resources on all nodes? I''ve found the inventory script by R.I.Pienaar ( http://www.devco.net/archives/2010/02/26/what_does_puppet_manage_on_a_node-2.php) which does what I want but only locally on each client. Is there any native way of syncing the client_yaml data centrally or any other way of doing this? I need a script-friendly way of checking which clients have this or that configuration, i.e. "which ip addresses are managed by puppet on client X" or "which files..." and so on. Regards, Adam -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On 7/7/2010 4:33 PM, Adam Winberg wrote:> Hi, > > are there any good ways of scripting an inventory of managed resources > on all nodes? I''ve found the inventory script by R.I.Pienaar > (http://www.devco.net/archives/2010/02/26/what_does_puppet_manage_on_a_node-2.php) > which does what I want but only locally on each client. Is there any > native way of syncing the client_yaml data centrally or any other way of > doing this? > > I need a script-friendly way of checking which clients have this or that > configuration, i.e. "which ip addresses are managed by puppet on client > X" or "which files..." and so on.If you activate storedconfigs, puppet will keep a database of all currently configured resources. Best Regards, David -- dasz.at OG Tel: +43 (0)664 2602670 Web: http://dasz.at Klosterneuburg UID: ATU64260999 FB-Nr.: FN 309285 g FB-Gericht: LG Korneuburg -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
ah, good point! i will look into it, thank you. //Adam On 9 July 2010 09:23, David Schmitt <david@dasz.at> wrote:> On 7/7/2010 4:33 PM, Adam Winberg wrote: > >> Hi, >> >> are there any good ways of scripting an inventory of managed resources >> on all nodes? I''ve found the inventory script by R.I.Pienaar >> ( >> http://www.devco.net/archives/2010/02/26/what_does_puppet_manage_on_a_node-2.php >> ) >> which does what I want but only locally on each client. Is there any >> native way of syncing the client_yaml data centrally or any other way of >> doing this? >> >> I need a script-friendly way of checking which clients have this or that >> configuration, i.e. "which ip addresses are managed by puppet on client >> X" or "which files..." and so on. >> > > If you activate storedconfigs, puppet will keep a database of all currently > configured resources. > > > Best Regards, David > -- > dasz.at OG Tel: +43 (0)664 2602670 Web: http://dasz.at > Klosterneuburg UID: ATU64260999 > > FB-Nr.: FN 309285 g FB-Gericht: LG Korneuburg > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
i''ve tested the storeconfigs option but i''m not fully getting what i want (do we ever..?). i''ve got quite a lot of files i sync with my clients via puppets fileserving capabilities. these files are tagged with different suffixes as labels, like: resolv.conf--serverA resolv.conf--CLUSTER1 resolv.conf--GROUP2 my.cnf--DBGROUP1 and so forth (and for the record - the files above are only examples and i do also use templates). what i want to do is query my puppetmaster which files a specific node is getting, from a fileserving point of view. if serverA is part of the DBGROUP1 group then my query would result in a list of files: my.cnf--DBGROUP1 resolv.conf--serverA any ideas on how to accomplish this? //Adam On 10 July 2010 10:48, Adam Winberg <adam.winberg@gmail.com> wrote:> ah, good point! i will look into it, thank you. > > //Adam > > > On 9 July 2010 09:23, David Schmitt <david@dasz.at> wrote: > >> On 7/7/2010 4:33 PM, Adam Winberg wrote: >> >>> Hi, >>> >>> are there any good ways of scripting an inventory of managed resources >>> on all nodes? I''ve found the inventory script by R.I.Pienaar >>> ( >>> http://www.devco.net/archives/2010/02/26/what_does_puppet_manage_on_a_node-2.php >>> ) >>> which does what I want but only locally on each client. Is there any >>> native way of syncing the client_yaml data centrally or any other way of >>> doing this? >>> >>> I need a script-friendly way of checking which clients have this or that >>> configuration, i.e. "which ip addresses are managed by puppet on client >>> X" or "which files..." and so on. >>> >> >> If you activate storedconfigs, puppet will keep a database of all >> currently configured resources. >> >> >> Best Regards, David >> -- >> dasz.at OG Tel: +43 (0)664 2602670 Web: http://dasz.at >> Klosterneuburg UID: ATU64260999 >> >> FB-Nr.: FN 309285 g FB-Gericht: LG Korneuburg >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To post to this group, send email to puppet-users@googlegroups.com. >> To unsubscribe from this group, send email to >> puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/puppet-users?hl=en. >> >> >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
That really does seem like something storeconfigs can give you, at least if you write the query. It''s basically finding all files owned by the host in question. Something like (in ActiveRecord): Puppet::Rails::Node.resources.find_all { |resource| resource.type == "file" }.collect { |resource| resource.title } That should return an array of file names. Haven''t tested it mind you, but something like that should work. Another option involves client-side opening the catalog and reading the files. I''ve written a script that does this for a bank that delivers its output to their auditors. Ended up being very simple. On Aug 10, 2010, at 7:34 AM, Adam Winberg wrote:> i''ve tested the storeconfigs option but i''m not fully getting what i > want (do we ever..?). > > i''ve got quite a lot of files i sync with my clients via puppets > fileserving capabilities. these files are tagged with different > suffixes as labels, like: > resolv.conf--serverA > resolv.conf--CLUSTER1 > resolv.conf--GROUP2 > my.cnf--DBGROUP1 > > and so forth (and for the record - the files above are only examples > and i do also use templates). > > what i want to do is query my puppetmaster which files a specific > node is getting, from a fileserving point of view. if serverA is > part of the DBGROUP1 group then my query would result in a list of > files: > my.cnf--DBGROUP1 > resolv.conf--serverA > > any ideas on how to accomplish this? > > //Adam > > On 10 July 2010 10:48, Adam Winberg <adam.winberg@gmail.com> wrote: > ah, good point! i will look into it, thank you. > > //Adam > > > On 9 July 2010 09:23, David Schmitt <david@dasz.at> wrote: > On 7/7/2010 4:33 PM, Adam Winberg wrote: > Hi, > > are there any good ways of scripting an inventory of managed resources > on all nodes? I''ve found the inventory script by R.I.Pienaar > (http://www.devco.net/archives/2010/02/26/what_does_puppet_manage_on_a_node-2.php > ) > which does what I want but only locally on each client. Is there any > native way of syncing the client_yaml data centrally or any other > way of > doing this? > > I need a script-friendly way of checking which clients have this or > that > configuration, i.e. "which ip addresses are managed by puppet on > client > X" or "which files..." and so on. > > If you activate storedconfigs, puppet will keep a database of all > currently configured resources. > > > Best Regards, David > -- > dasz.at OG Tel: +43 (0)664 2602670 Web: http:// > dasz.at > Klosterneuburg UID: > ATU64260999 > > FB-Nr.: FN 309285 g FB-Gericht: LG Korneuburg > > -- > You received this message because you are subscribed to the Google > Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com > . > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en > . > > > > > -- > You received this message because you are subscribed to the Google > Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com > . > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en > .-- Man is the only animal that can remain on friendly terms with the victims he intends to eat until he eats them. -- Samuel Butler (1835-1902) --------------------------------------------------------------------- Luke Kanies -|- http://puppetlabs.com -|- +1(615)594-8199 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
----- "Luke Kanies" <luke@puppetlabs.com> wrote:> That really does seem like something storeconfigs can give you, at > least if you write the query. > > > It''s basically finding all files owned by the host in question. > Something like (in ActiveRecord): > > > Puppet::Rails::Node.resources.find_all { |resource| resource.type => "file" }.collect { |resource| resource.title } > > > That should return an array of file names. Haven''t tested it mind you, > but something like that should work. > > > Another option involves client-side opening the catalog and reading > the files. I''ve written a script that does this for a bank that > delivers its output to their auditors. Ended up being very simple.I have a script like this at http://www.devco.net/archives/2010/02/26/what_does_puppet_manage_on_a_node-2.php Not tested on 2.6 yet though. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
i''ve tested the localconfig.yaml parser and it works well, but it only shows which files puppet handles from a client point of view. i.e it shows that puppet manages "/etc/my.cnf" for my client but i really want to see which file it manages from a server point of view, i.e. "/path/to/fileshare/etc/my.cnf--DBGROUP1". as far as i can see, storeconfigs gives me about the same information as mr. Pienaars localconfig-parserscript. That is, i can see that puppet manages "/etc/my.cnf" for this client but i cant see from which source this file is taken. If I''m wrong, I would be very grateful for an example query. //Adam On 10 August 2010 22:59, R.I.Pienaar <rip@devco.net> wrote:> > ----- "Luke Kanies" <luke@puppetlabs.com> wrote: > > > That really does seem like something storeconfigs can give you, at > > least if you write the query. > > > > > > It''s basically finding all files owned by the host in question. > > Something like (in ActiveRecord): > > > > > > Puppet::Rails::Node.resources.find_all { |resource| resource.type => > "file" }.collect { |resource| resource.title } > > > > > > That should return an array of file names. Haven''t tested it mind you, > > but something like that should work. > > > > > > Another option involves client-side opening the catalog and reading > > the files. I''ve written a script that does this for a bank that > > delivers its output to their auditors. Ended up being very simple. > > > I have a script like this at > http://www.devco.net/archives/2010/02/26/what_does_puppet_manage_on_a_node-2.php > > Not tested on 2.6 yet though. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
i discovered by accident that i can sort of get the functionality i want by using puppets apache logs (i run puppet via apache+passenger). In the access log each attempt to fetch a file from puppets fileserver is logged, if the file is absent it logs a 404 and if it is a match a 200 return code: clientX - - [27/Aug/2010:12:02:50 +0000] "GET /production/file_metadata/lindafiles/etc/rsyslog.d/rsyslog-puppet.conf-- HTTP/1.1" 404 75 "-" "-" clientX - - [27/Aug/2010:12:02:50 +0000] "GET /production/file_metadata/lindafiles/etc/rsyslog.d/rsyslog-puppet.conf--NOTEBOOK HTTP/1.1" 404 83 "-" "-" clientX - - [27/Aug/2010:12:02:50 +0000] "GET /production/file_metadata/lindafiles/etc/rsyslog.d/rsyslog-puppet.conf--DEFAULT HTTP/1.1" 200 357 "-" "-" in the above exemple it is the file rsyslog-puppet.conf--DEFAULT that is matched for my clientX. i could do a simple grep/awk/sort script which looks through the log file and collects fileserver entries with the 200 return code. not so pretty though, would be nice to have a native command in the puppetmaster for this. //Adam On 11 August 2010 08:28, Adam Winberg <adam.winberg@gmail.com> wrote:> i''ve tested the localconfig.yaml parser and it works well, but it only > shows which files puppet handles from a client point of view. i.e it shows > that puppet manages "/etc/my.cnf" for my client but i really want to see > which file it manages from a server point of view, i.e. > "/path/to/fileshare/etc/my.cnf--DBGROUP1". > > as far as i can see, storeconfigs gives me about the same information as > mr. Pienaars localconfig-parserscript. That is, i can see that puppet > manages "/etc/my.cnf" for this client but i cant see from which source this > file is taken. If I''m wrong, I would be very grateful for an example query. > > //Adam > > > On 10 August 2010 22:59, R.I.Pienaar <rip@devco.net> wrote: > >> >> ----- "Luke Kanies" <luke@puppetlabs.com> wrote: >> >> > That really does seem like something storeconfigs can give you, at >> > least if you write the query. >> > >> > >> > It''s basically finding all files owned by the host in question. >> > Something like (in ActiveRecord): >> > >> > >> > Puppet::Rails::Node.resources.find_all { |resource| resource.type =>> > "file" }.collect { |resource| resource.title } >> > >> > >> > That should return an array of file names. Haven''t tested it mind you, >> > but something like that should work. >> > >> > >> > Another option involves client-side opening the catalog and reading >> > the files. I''ve written a script that does this for a bank that >> > delivers its output to their auditors. Ended up being very simple. >> >> >> I have a script like this at >> http://www.devco.net/archives/2010/02/26/what_does_puppet_manage_on_a_node-2.php >> >> Not tested on 2.6 yet though. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To post to this group, send email to puppet-users@googlegroups.com. >> To unsubscribe from this group, send email to >> puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/puppet-users?hl=en. >> >> >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.