Exec script from puppet file server

240 views
Skip to first unread message

zerozer...@gmail.com

unread,
Feb 7, 2014, 6:16:57 AM2/7/14
to puppet...@googlegroups.com
Hi,
I need to use an exec resource to execute a shell script, and I'd like to keep the script on the puppet master.

Is there a way to make the exec resource execute the script directly from puppet's built-in file server? It doesn't seem to accept the puppet:/// URI type.

Otherwise I will need to copy it locally on the client and execute it from there (and maybe delete it afterwards).

Thanks.
Marco

jcbollinger

unread,
Feb 10, 2014, 9:54:30 AM2/10/14
to puppet...@googlegroups.com


On Friday, February 7, 2014 5:16:57 AM UTC-6, zerozer...@gmail.com wrote:
Hi,
I need to use an exec resource to execute a shell script, and I'd like to keep the script on the puppet master.

Is there a way to make the exec resource execute the script directly from puppet's built-in file server? It doesn't seem to accept the puppet:/// URI type.


No, of course not.  The 'command' property of an Exec (or its title if you don't specify the 'command' as a separate parameter) is a literal command such as you would issue from a shell.  Shells don't do URIs.

 

Otherwise I will need to copy it locally on the client and execute it from there (and maybe delete it afterwards).



That is a viable option.  Alternatively, on a POSIX system such as Linux, you could also do something like this:

exec { 'myscript':
  command => file('/path/to/script'),
  provider => 'shell'
}

where /path/to/script is the location of your script on the master.  That includes the full content of the script directly in the catalog, bypassing Puppet's file server.


John

Reply all
Reply to author
Forward
0 new messages