Re: [Puppet Users] managing vmware-tools with puppet
So setting aside if this is a good idea or not, you can do this in a single exec resource. Look at https://docs.puppet.com/puppet/latest/reference/types/exec.html Pay particular attention to onlyif, refreshonly, unless, and creates. Used either alone or in concert with the file resource type (https://docs.puppet.com/puppet/4.6/reference/types/file.html#file-attribute-source), you can set up something roughly like: file { 'somepath/vmtools.tar.gz': source => 'http://somesite/vmtools.tar.gz', notify => exec['vmtoolsinst'] } -> exec { 'vmtoolsinst': command => 'stuffs', refreshonly => true } which will download the file then run a command on it if it had to download the file. You could also chain execs ala: exec { 'curl -o somepath http://somesite/vmtoolsd': onlyif => 'shell eval of vmware-toolbox-cmd -v output', notify => vmtoolsinst } exec { 'vmtoolsinst': command => 'stuffs', refreshonly => true } Now going beyond that, you could add in a custom fact to capture the value of vmware-toolbox-cmd. This would look something like: Facter.add('vmtools-toolbox-cmd') do setcode do Facter::Core::Execution.exec(' vmware-toolbox-cmd -v') end end You would then be able to do logic based off this fact. Really though, you should just use the forge - there's a puppet approved module for vmtools: https://forge.puppet.com/razorsedge/vmwaretools HTH, --Nick On Wed, Aug 10, 2016 at 11:45 PM, Alex Samadwrote: > Hi > > so I have a repo of vmware-tools.*.tgz files located at a website. > > how do I build a module to check > 1) is vmware tool install - check does vmware-toolbox-cmd exist > 2) is it the right version - check for current version is vmware-toolbox-cmd > -v > > I want to add version number into my hiera DB. think i have worked out. but > not sure how to do the client test. > > I am guessing (psydo code) > > if exist vmware-toolbox-cmd and if vmware-toolbox-cmd -v >= wanted> > then > do nothing > else > wget file > run vmware-install > fi > > > > -- > 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/7e990f42-22b6-4aff-8887-83768e086cb8%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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/CAKJ8awfg4Z1ZoWXsvtykZjFOJ7%3DwqKSYoFi5q%3DJkZwq90o1ugw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [Puppet Users] Exported resources from multiple sources?
You'd have to mine the database and reconstruct the exported resource as a resource, but it would be doable. I was assuming strict adherance to what an exported resource is wasn't really what Atom was after. --Nick On Fri, Oct 31, 2014 at 9:28 AM, jcbollinger john.bollin...@stjude.org wrote: On Thursday, October 30, 2014 12:00:21 PM UTC-5, Nick Cammorato wrote: I don't see why you couldn't write a hiera backend to do exactly this. The current puppetdb hiera backend wouldn't be too hard to modify to do it I don't think. You couldn't write an Hiera back end to do this particular thing because Hiera is not involved in collecting exported resources. You could write a DB-based Hiera backend that bridges networks, but it wouldn't be useful for exported resources. John -- 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/dfb3ff9a-0f2b-421a-900e-e9c27cb88efa%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- 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/CAKJ8aweAeTOu%2BCwF0GHy9abJ5zRfDhFniKGNRSDTLqYtuizhrw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [Puppet Users] Exported resources from multiple sources?
I don't see why you couldn't write a hiera backend to do exactly this. The current puppetdb hiera backend wouldn't be too hard to modify to do it I don't think. --Nick On Thu, Oct 30, 2014 at 12:36 PM, Atom Powers atom.pow...@gmail.com wrote: Is it possible, and how, to collect exported resources from multiple puppetdb sources? I have a network which, for policy reasons, can not connect back into the main network but the main network can connect into the partitioned network. I have a stand-alone puppet master in the partitioned network that generates stored resources for Nagios in exactly the same way as the main network. Is there a way for the puppet master on the main network to collect the stored resources from the partitioned network and the stored resources from the main network to build a Nagios server that checks both networks? Putting a single puppet master in the partitioned network isn't an option for the same reason that the network is a partitioned one. -- Perfection is just a word I use occasionally with mustard. --Atom Powers-- -- 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/CAF-H%3DO%3DYvnJQDo1Jm8sQoYDuQobE_%2BFjLjgpT9OiBYLAFQ5QeA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout. -- 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/CAKJ8awe0cdXyB-n9caxODAGVrkMdjh%2Bvqb7pfGFdOrqXf_s-9g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [Puppet Users] jenkins workflow
Pre-commit hooks are great but Github and github enterprise won't enforce them(arbitrary code on the server is uncool for some reason), so if you want to be 100% and use either they still need to be run as part of your jenkins build task. On Aug 6, 2014 7:11 PM, John Warburton jwarbur...@gmail.com wrote: On 7 August 2014 02:17, Bernard Clark berniecla...@gmail.com wrote: I'm setting up a jenkins server to perform continuous integration on my puppet codebase, and I'm interested in running at least the following tests: - puppet parser validate - puppet lint These are cheap to do. Give yourself immediate feedback by making them pre commit hooks - http://puppetlabs.com/blog/how-set-git-commit-hooks-puppet-enterprise - rspec-puppet - test-kitchen Have I overlooked any other worthwhile tests, and has the community distilled any wisdom about best practices, particularly regarding git workflow? Any advice would be much appreciated! Look at server spec as well - http://serverspec.org/ John -- 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/CAAJLFxV%2BmR%3D88Wkh-GXYqOuZdboXdH2YTV%3DtAM47n0yUVNegKQ%40mail.gmail.com https://groups.google.com/d/msgid/puppet-users/CAAJLFxV%2BmR%3D88Wkh-GXYqOuZdboXdH2YTV%3DtAM47n0yUVNegKQ%40mail.gmail.com?utm_medium=emailutm_source=footer . For more options, visit https://groups.google.com/d/optout. -- 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/CAKJ8awdGpfA7Ox9TbYqgdfOwLMax-2mTqvQZ1PpxKZjToGnZWw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [Puppet Users] Re: Puppet fails to run if ruby1.8 is not installed.
Did anyone try using the EL7 RPM? I've had success with testing with it in the RHEL7 beta, so if amazon has moved closer to RHEL7, it should be worth a shot. --Nick On Fri, Apr 4, 2014 at 3:40 PM, Tom Poulton poulton...@gmail.com wrote: I was running into this problem as well so I ran: *sudo cp -r /usr/lib/ruby/site_ruby/1.8/* /usr/local/share/ruby/site_ruby/2.0/* /usr/local/share/ruby/site_ruby/2.0/ is part of the $LOAD_PATH so I figured why not stick the files in there and see what happens, now I can run *puppet --version* plus *facter ipaddress* etc. That's all I've run so far so there might be some weirdness down the line, but it's a start!? It would be better if it was a symlink or something so you wouldn't have to run this again after a yum update, but hopefully puppetlabs will ralease a new RPM soon that works, I'm guessing they will now that AWS are running ruby 2.0.0 as default!? -- 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/ada194cd-89bb-49dd-841b-39c4f2cbf42b%40googlegroups.comhttps://groups.google.com/d/msgid/puppet-users/ada194cd-89bb-49dd-841b-39c4f2cbf42b%40googlegroups.com?utm_medium=emailutm_source=footer . For more options, visit https://groups.google.com/d/optout. -- 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/CAKJ8awe7owwc7%2BSrFo0%2BeuRZaRPkW79OjQxoHwPOnkpPM%3DCLRA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [Puppet Users] Augeas: Duplicate declaration
Sorry, didn't realize it was a hash of hashes. You just need the augeas resource to have a unique name - entry[$name][hostname] or ipaddress should work. IE: define a_thing { augeas { 'host_entry': } } a_thing { 'a': } a_thing { 'b': } Will generate an error like you are seeing. define a_thing { augeas { host_entry_${name}: } } a_thing {'a': } a_thing {'b': } Will not. On Fri, Jan 17, 2014 at 1:07 PM, Andrey Kozichev akozic...@gmail.comwrote: ah, right you are supplying entire hash in your defined resource. Missed it. If your defined resource would accept: name, iphost and hostname - then you can use create_resources to define all 3 entry. On 17 Jan 2014 15:21, Reinaldo Lima reiml...@gmail.com wrote: With create_resources the error is: *Invalid parameter hostName on node* And including the entry[name] in the resource name: *Resource title must be a String, not Hash* =( On Friday, January 17, 2014 5:10:16 AM UTC-2, Andrew wrote: another option to use create_resources('hostinclude',$netentry) On 16 Jan 2014 23:47, Nick Cammorato nick.ca...@gmail.com wrote: Your augeas resource is always called hosts_include which is why it's doing that. Try including the entry[name] in that resource name. On Jan 16, 2014 4:15 PM, Reinaldo Lima reim...@gmail.com wrote: Hi Everyone, I'm trying to write a class that put some entries in /etc/hosts file as follow below: *class hosts {* *$netentry = {* *host01 = { iphost = '192.168.10.1', hostName = host01 },* *host02 = { iphost = '192.168.10.2', hostName = host02 },* *host03 = { iphost = '192.168.10.3', hostName = host03 },* *}* *define hostsinclude ($entry) {* * augeas { hosts_include:* * incl = /etc/hosts,* * lens = Hosts.lns,* * changes = [* * set /files/etc/hosts/01/ipaddr $entry[$name]['iphost'],* * set /files/etc/hosts/01/canonical$entry[$name]['hostName'],* * ],* * onlyif = match */ipaddr[ . = $entry[$name]['iphost'] ] size == 0* * }* *}* *hostsinclude { [* *'host01',* *'host02',* *'host03'* *]:* *entry = $netentry* *}* *}* and, when puppet compiles the manifest, I get the following error: *err: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Augeas[hosts_include] is already declared in file /puppet/environments/production/modules/checklist/manifests/hosts.pp at line 10; cannot redeclare at /puppet/environments/production/modules/checklist/manifests/hosts.pp:29 on node* Someone can help me? 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/fe9040f2-54de-4f9c-9787-4736b37219d9% 40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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/CAKJ8awc5X%2B97jtxwbe%3DpjqhjqyuF8S_dR_ GvAAXM%2BC8t3FC9xA%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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/4f31358c-652d-4afc-9919-aae783afa36c%40googlegroups.com . For more options, visit https://groups.google.com/groups/opt_out. -- 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/CACzr%3DFdwj-bmkdUzMoutEBLPMa%2BZA%3Dt7v98COQfT%2Bk%2BjBrUzGg%40mail.gmail.com . For more options, visit https://groups.google.com/groups/opt_out. -- 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
Re: [Puppet Users] Augeas: Duplicate declaration
Your augeas resource is always called hosts_include which is why it's doing that. Try including the entry[name] in that resource name. On Jan 16, 2014 4:15 PM, Reinaldo Lima reiml...@gmail.com wrote: Hi Everyone, I'm trying to write a class that put some entries in /etc/hosts file as follow below: *class hosts {* *$netentry = {* *host01 = { iphost = '192.168.10.1', hostName = host01 },* *host02 = { iphost = '192.168.10.2', hostName = host02 },* *host03 = { iphost = '192.168.10.3', hostName = host03 },* *}* *define hostsinclude ($entry) {* * augeas { hosts_include:* * incl = /etc/hosts,* * lens = Hosts.lns,* * changes = [* * set /files/etc/hosts/01/ipaddr $entry[$name]['iphost'],* * set /files/etc/hosts/01/canonical$entry[$name]['hostName'],* * ],* * onlyif = match */ipaddr[ . = $entry[$name]['iphost'] ] size == 0* * }* *}* *hostsinclude { [* *'host01',* *'host02',* *'host03'* *]:* *entry = $netentry* *}* *}* and, when puppet compiles the manifest, I get the following error: *err: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Augeas[hosts_include] is already declared in file /puppet/environments/production/modules/checklist/manifests/hosts.pp at line 10; cannot redeclare at /puppet/environments/production/modules/checklist/manifests/hosts.pp:29 on node* Someone can help me? 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/fe9040f2-54de-4f9c-9787-4736b37219d9%40googlegroups.com . For more options, visit https://groups.google.com/groups/opt_out. -- 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/CAKJ8awc5X%2B97jtxwbe%3DpjqhjqyuF8S_dR_GvAAXM%2BC8t3FC9xA%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
[Puppet Users] Refactoring my modules and moving from 2.7.x to 3.3 and have a few questions
Mostly surrounding if there are better(less hackish) ways of doing things. The first is the classic exported resource expiration problem. My existing modules use a wrapper that uses an inline template to call out to Ruby's Time function, set a timestamp, and set the resource to absent after an expiration period, a cleanup script then runs on the database node and purges exported resources that belong to nodes that would qualify as unresponsive + a grace period of a few days. I see I can now generify this a bit more with create_resources, but Is there a better or built-in way to do this now? The second involves puppet being declarative and the edge cases where you really need it not to be. A lot of times I wound up writing custom providers or lenses to skirt around this, but when that just wouldn't do(or was overkill), I used a rather hackish wrapper around Puppet::Provider::Collection. I'd either construct the Collection and then evaluate it(when I wanted the resources realized) or do an instance_eval to directly access the private collection method, followed by a map/collect to convert the selected resource into a hash, and return a entirely constructed array composed of said hashes. I was never quite able to figure out how I was supposed to pass in equery/vquery, so I wound up re-implementing those and the whole thing is pretty inefficient and a bit dangerous. All I really need to be able to do is collect say, all exported resources of type foo with target bar into an array so I can iterate through it in some of my templates where a provider is overkill and no lens is available. Is this possible yet, or are we still stuck on never allowing this? Thanks for any replies, --Nick -- 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 post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
[Puppet Users] Re: Status of STONITH support in the puppetlabs corosync module?
You should be able to rig something up using the existing cs_primitive, cs_clone and cs_property provider/types, although I've avoided doing this as it worries me. The problem as far as I can tell is that cs_primitive assumes a provider, primitive class, and primitive type, and stonith resource primitives lack the provider. You'd need to modify cs_primitive(particularly the flush section) to allow a 0 length or nil provided_by value, and then could do the following. IE (from the cluster labs CRM fencing example: http://clusterlabs.org/doc/crm_fencing.html ) cs_primitive { 'dummy-stonith'': primitive_class = 'stonith', primitive_type = 'null', params = { 'hostlist' = 'node1 node2' } } cs_clone { 'fencing': primitive = 'dummy-stonith' } Which should translate to: crm configure primitive dummy-stonith stonith:null params hostlist=node1 node2 crm configure clone fencing dummy-stonith And then of course set your properties. -- 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/-/_ElTvDlGW9oJ. 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: Apparent problem with resource ordering using Puppetlabs Corosync module (does not bring up HA resources in correct order when configured to do so)
Which puppetlabs-corosync are you using? There are 19 forks of it last I checked(including one by me for my own needs surrounding DRBD which is now horribly out of date). I would change this: cs_order { 'jboss_ip_before_jboss': first = 'applayer_ip', second = 'applayer_jboss', require = Cs_colocation['jboss_with_ip'], } to cs_order { 'jboss_ip_before_jboss': first = 'applayer_ip', second = 'applayer_jboss', score = 'INFINITY', require = Cs_primitive['applayer_ip','applayer_jboss'], } and cs_colocation { 'jboss_with_ip': primitives = [ 'applayer_ip', 'applayer_jboss' ], require = Cs_primitive['applayer_ip','applayer_jboss'], } as autorequires were very, very dicey when I mucked with the module. Ignore this if they work now. Also - make sure you're not setting up the IP or the service anywhere else as corosync should be managing it. Outside of puppet, are you sure IPaddr2 is the right primitive_class? Can we get the output of a crm configure show, and if it's missing the primitive if it takes: crm configure primitive applayer_ip ocf:heartbeat:IPaddr2 params ip=whatever cidr_netmask=whatever because I suspect that's the problem. -- 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/-/tzNfECQp_LcJ. 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: How to do release managment integration with puppet?
Right now we're deploying via cap and something custom and part of the deployment is a config yaml file which puppet parses via facter in order to determine how to do the OS/middleware config. It works fairly well, but it feels kludgy to do it this way. I've been wanting to cook something up like what it sounds like you want for a while, since I hate push-based models, and I hate using ssh as a transport. This means there is almost nothing that makes me happy around right now. The basic idea is to have a web application that handles deployment, maintains a version to revision database(one of our old systems uses SVN and does this via tags, which gets, well, bad after a few years), plus metadata surrounding the release, like configuration information. Deployment is done by issuing an mcollective command to do a pull/clone/checkout/update/whatever from a VCS onto the target server. Config information is transferred into puppet via the master over REST from the deployment server using the ruby DSL, with everything stored in one big hash. You would require that module and then use those variables in your own modules, with a sanity check to verify the code actually updated. On Friday, November 30, 2012 12:37:11 PM UTC-5, Schofield wrote: I am at the beginning of merging the traditional OS/Middleware update process with application development release process. The goal is to be able to test a complete versioned OS/Middleware/Application stack as it moves through dev/test/qa/prod environments. The key here is that entire stack is labeled under a single version. In other terms, the node and everything on it is aligned under a single version. Right now the OS/Middleware is managed by puppet. The application release process is not. I'm hoping some folks would like to comment on the following questions I am pondering. - How to best version puppet classes and control the classification of nodes based on the version of the node? - Are there ENC's that integrate with SVN/GIT that make this easy? - Should application deployment be brought under the control of puppet? - If so how do you easily do this without burdening applications developers with having to learn something about or have access to puppet? - Is there a puppet API that an existing application release processes can leverage to trigger OS/Middleware updates when an application version is updated? Looking forward to your comments. -- 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/-/481nwg4Grc0J. 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.
Re: [Puppet Users] Using catalog inventory/Puppet::Resource::Catalog?
I'm going to try this again and hope I forgot to hit submit rather than having a message to the list pending for approval. I want a list of classes contained in the puppet catalog that's been applied to the node, not management classes. At least in mco 2.0.0 with minimal configuration, an mco inventory some.host or mco rpc rpcutil inventory -I some.host lists facts and mgmt classes. Now, I'm fairly new to mcollective, so I might be missing something obvious, in which case I'd greatly appreciate being told what :) What I started with was as an erb template for facts.yaml: % # Gather all of our scope variables gather_vars = scope.to_hash.reject{ |k,v| k.to_s =~ /(uptime|free|timestamp|id|name|title|rsa|dsa)/ } # And then all of classes gather_vars.store('classcatalog', classes.sort.uniq.join(', ')) -% %= gather_vars.to_yaml % And boom I can do an mco find --with-fact classcatalog=/corosync/ and it'll list all my nodes which use my corosync modules. Which appears to work, but I'm a bit leary of this since so much in puppet depends on order of execution and I've seen some odd scoping issues with staging. So while I have this being populated last, and use an ENC 90% of the time(which populates the management classes), and it all works, it might break in the future. I was hoping there was another way of exposing this. On Thursday, July 12, 2012 7:14:16 PM UTC-4, R.I. Pienaar wrote: - Original Message - From: Nick Cammorato nick_cammor...@terc.edu To: puppet-users@googlegroups.com Sent: Thursday, July 12, 2012 5:35:28 PM Subject: [Puppet Users] Using catalog inventory/Puppet::Resource::Catalog? I'd like to be able to get a list of all of the classes being applied to my nodes and insert this as a list into mcollective's facts.yaml file. The reason for this is that I have a couple post-commit hooks that parse out changes to specific modules/classes for changelog purposes and I'm considering adding in a call to mco find to include a list of affected nodes in the report. Which means the facts need to be there to be found. mcollective already knows what classes are on a host, you can access it on the cli: mco rpc rpcutil inventory -I some.host -- 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/-/5PJdUxXAAaYJ. 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.
Re: [Puppet Users] Using catalog inventory/Puppet::Resource::Catalog?
Sorry, I should've clarified. I was hoping to use the management classes for something other than puppet classes(more abstract things like nagios hostgroups, some of which share names with classes). If I can't reliably populate the facts with class information though, I might not have a choice. On Saturday, July 14, 2012 11:36:50 AM UTC-4, R.I. Pienaar wrote: - Original Message - From: Nick Cammorato nick_cammor...@terc.edu To: puppet-users@googlegroups.com Sent: Saturday, July 14, 2012 3:04:48 PM Subject: Re: [Puppet Users] Using catalog inventory/Puppet::Resource::Catalog? I'm going to try this again and hope I forgot to hit submit rather than having a message to the list pending for approval. I want a list of classes contained in the puppet catalog that's been applied to the node, not management classes. At least in mco 2.0.0 with minimal configuration, an mco inventory some.host or mco rpc rpcutil inventory -I some.host lists facts and mgmt classes. Now, I'm fairly new to mcollective, so I might be missing something obvious, in which case I'd greatly appreciate being told what :) What I started with was as an erb template for facts.yaml: % # Gather all of our scope variables gather_vars = scope.to_hash.reject{ |k,v| k.to_s =~ /(uptime|free|timestamp|id|name|title|rsa|dsa)/ } # And then all of classes gather_vars.store('classcatalog', classes.sort.uniq.join(', ')) -% %= gather_vars.to_yaml % And boom I can do an mco find --with-fact classcatalog=/corosync/ and it'll list all my nodes which use my corosync modules. Which appears to work, but I'm a bit leary of this since so much in puppet depends on order of execution and I've seen some odd scoping issues with staging. So while I have this being populated last, and use an ENC 90% of the time(which populates the management classes), and it all works, it might break in the future. I was hoping there was another way of exposing this. I am not following, you do not need to gather this information for mcollective to be aware of classes. Puppet creates a file on every node that has a list of all the classes on said node, on my machines this is in /var/lib/puppet/classes.txt So I configure mcollective with: classesfile = /var/lib/puppet/classes.txt and now I can just do mco find -C /someclass/ and it does what you want no need to try and turn those into a fact or anything like that. And if I do 'mco inventory some.node' I get a section displayed like: Configuration Management Classes: apache apache::config apache::installapache::logrotate Does this method not work for you? -- 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/-/aTomd-7TN9sJ. 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.
Re: [Puppet Users] Using catalog inventory/Puppet::Resource::Catalog?
That would actually be nice for other reasons, but I think I can whip something up to do that on my own if I need it. After giving it a bit of thought, I realized this is yet another thing where I can do exactly what I'd like to do but just not quite exactly the way I'd like to do it. This seems to keep happening to me with anything related to ruby. I fight the framework for a while, bang my head into walls, then finally accept it and grow to love whatever it was I didn't initially like. There's no actual need to have puppet classes as facts and other information as management classes when I can just insert what I was going to insert as a management class in as a fact. IE: What I wanted to do was have a management class monitor that corresponds to a group of nodes residing in the same network/host segment that do different things, a fact class=monitor that corresponds to the puppet nagios servers class, a fact environment=monitor that dictates a puppet environment, and a hostgroups=monitor fact that corresponds to the nagios hostgroup monitor. Moving the class=monitor fact to the management class doesn't preclude me from adding a security-zone=monitor or a dozen other facts like that for the purposes of ridiculous granularity in categorization and that can be inserted in a number of different ways. It's just not quite the organizational hierarchy I originally envisioned, but it accomplishes exactly the same thing. I'm still kind of curious if there's a reliable way to access the class list or full catalog during any point in a puppet run though, because I can think of a few other things that might be useful for(and a few ways to make things spectacularly blow up). But now that's way more academic. On Saturday, July 14, 2012 12:33:02 PM UTC-4, R.I. Pienaar wrote: - Original Message - From: Nick Cammorato nick_cammor...@terc.edu To: puppet-users@googlegroups.com Sent: Saturday, July 14, 2012 5:02:29 PM Subject: Re: [Puppet Users] Using catalog inventory/Puppet::Resource::Catalog? Sorry, I should've clarified. I was hoping to use the management classes for something other than puppet classes(more abstract things like nagios hostgroups, some of which share names with classes). If I can't reliably populate the facts with class information though, I might not have a choice. i could add a feature where instead of just classes.txt it reads a list of files and search against them all, then you can use puppet classes as well as another file you manage in some other way -- 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/-/7E1uLxzFaIsJ. 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: How can I list classes available on the puppet master?
You could do something like this, it's not the cleanest in the world(I barely ever use sed anymore), but as something quick and dirty: curl -k -H Accept: yaml https://puppet:8140/mgmt/resource_types/class | more | grep name: | sed -e 's/^ *name: //;s/id.* //' | sort | uniq It'll have some bad data you'll have to parse out(built-in classes like notify, fail, etc.), but should work. On Thursday, July 12, 2012 11:54:25 AM UTC-4, llo...@oreillyauto.com wrote: Is there a way to get a list of all the classes available from the puppet master? I have 2 goals for this - one is documentation in a human readable form, and the other is potentially importing that data into dashboard. I did find some info on the rest API ( http://docs.puppetlabs.com/guides/rest_api.html#resource-types ) but I can't make any sense of the output from it. Thanks. Lee On Thursday, July 12, 2012 11:54:25 AM UTC-4, llo...@oreillyauto.com wrote: Is there a way to get a list of all the classes available from the puppet master? I have 2 goals for this - one is documentation in a human readable form, and the other is potentially importing that data into dashboard. I did find some info on the rest API ( http://docs.puppetlabs.com/guides/rest_api.html#resource-types ) but I can't make any sense of the output from it. Thanks. Lee On Thursday, July 12, 2012 11:54:25 AM UTC-4, llo...@oreillyauto.com wrote: Is there a way to get a list of all the classes available from the puppet master? I have 2 goals for this - one is documentation in a human readable form, and the other is potentially importing that data into dashboard. I did find some info on the rest API ( http://docs.puppetlabs.com/guides/rest_api.html#resource-types ) but I can't make any sense of the output from it. Thanks. Lee On Thursday, July 12, 2012 11:54:25 AM UTC-4, llo...@oreillyauto.com wrote: Is there a way to get a list of all the classes available from the puppet master? I have 2 goals for this - one is documentation in a human readable form, and the other is potentially importing that data into dashboard. I did find some info on the rest API ( http://docs.puppetlabs.com/guides/rest_api.html#resource-types ) but I can't make any sense of the output from it. Thanks. Lee -- 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/-/m4XmKKAYwtkJ. 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] Using catalog inventory/Puppet::Resource::Catalog?
I'd like to be able to get a list of all of the classes being applied to my nodes and insert this as a list into mcollective's facts.yaml file. The reason for this is that I have a couple post-commit hooks that parse out changes to specific modules/classes for changelog purposes and I'm considering adding in a call to mco find to include a list of affected nodes in the report. Which means the facts need to be there to be found. Now, puppet stores this in /var/lib/puppet/client_yaml/catalog/${fqdn}.yaml, and I could write it up as a custom fact extremely easily, or I could drop down to ruby and parse it out of the catalog that way, but I'm wondering if there's a built in path of exposure to that information somewhere. Just a list of all classes in the catalog. Anyone know offhand? -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.