mentby.com
Blog | Jobs | Help | Signup | Login

Capture the output of exec command



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*******.
To unsubscribe from this group, send email to puppet-users+unsubscribe*******.
For more options, visit this group at  http://groups.google.com/group/puppet-users?hl=en.


sateesh Tue, 21 Feb 2012 01:00:10 -0800

Hi Sateesh,

I need to capture the output of an exec command in puppet manifest

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*******.
To unsubscribe from this group, send email to puppet-users+unsubscribe*******.
For more options, visit this group at  http://groups.google.com/group/puppet-users?hl=en.


ptman Tue, 21 Feb 2012 01:06:43 -0800

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*******.
To unsubscribe from this group, send email to puppet-users+unsubscribe*******.
For more options, visit this group at  http://groups.google.com/group/puppet-users?hl=en.


Alexander Swen Tue, 21 Feb 2012 01:18:18 -0800

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*******.
To unsubscribe from this group, send email to puppet-users unsubscribe*******.
For more options, visit this group at  http://groups.google.com/group/puppe-users?hl=en.


jcbollinger Tue, 21 Feb 2012 06:15:55 -0800



Related Topics

Post a Comment