Hi, I need to capture the output of an exec command in puppet manifest variable. How can I do this. Thanks in advance, Sateesh B. -- 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.
Paul Tötterman
2012-Feb-21 09:06 UTC
[Puppet Users] Re: Capture the output of exec command
Hi Sateesh, I need to capture the output of an exec command in puppet manifest> variable. How can I do this. >You cannot, since the manifest is compiled into a catalog on the puppet master and then the catalog is sent to the agent, which can be on a different machine, and only then is the command defined by the exec run. Can you describe in more detail what you are actually trying to do? ( http://www.joelonsoftware.com/items/2008/01/22.html ) Cheers, Paul -- 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/-/tj3xSM8JgTAJ. 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.
Alexander Swen
2012-Feb-21 09:18 UTC
[Puppet Users] Re: Capture the output of exec command
> > You cannot, since the manifest is compiled into a catalog on the puppet > master and then the catalog is sent to the agent, which can be on a > different machine, and only then is the command defined by the exec run. >Ehrm, personly I would try: exec { "put text in a file": command => "ls -la /etc>>/var/log/exec 2>&1"; or command => "ls -la /etc 2>&1 |tee /var/log/exec"; } -- 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/-/4TowgNHPooYJ. 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 Feb 21, 3:00 am, sateesh <bbalasate...@gmail.com> wrote:> I need to capture the output of an exec command in puppet manifest > variable. How can I do this.As Paul observed, what you ask is inconsistent with Puppet''s manner of operation. How you should proceed instead depends on what you are trying to accomplish. A custom fact may provide what you are looking for: you can easily add a custom fact to your system that will run a command on the node *before* each catalog request, and provide the output as a fact (accessible as a top-level Puppet variable). The documentation for custom facts (http://docs.puppetlabs.com/guides/custom_facts.html) provides an example of exactly that. John -- 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.