On Thursday, May 8, 2014 12:36:56 PM UTC-5, Ritesh Nanda wrote: > > Thanks Henrik , > > I would like to find a file and parse it , so that would be on the agent > , creating a puppet function would not work , as master will not be able > to access those files. >
Neither would anything written in Ruby DSL, for much the same reason. > You said Can be done with Resources , how can i include a ruby block in my > manifest , i know using exec resource i can run a ruby script , but any > better way to do it. > > You can execute more or less arbitrary Ruby code from your manifest via an ERB template, using the built-in template() or inline_template() function. You can serve some purposes for which you might want Ruby by enabling and using the 'future' parser. But all of that runs on the master, in order to build a "catalog" describing the resources and properties to manage on the target node. If you want to run custom Ruby code on the client as part of a Puppet run then you must build a plugin<http://docs.puppetlabs.com/puppet/#hacking-and-extending-ruby-plugins>with which Puppet (or Facter) will do so. If the purpose is to gather information to inform catalog construction, then your plugin should be a custom fact <http://docs.puppetlabs.com/guides/custom_facts.html>. If the purpose is to modify the system then you want a custom resource type and a provider for it <http://docs.puppetlabs.com/guides/custom_types.html>. 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/c92d012d-99c6-4de3-b74e-44beda2e3622%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.