Ahmed El Gamil
2010-Aug-19 00:17 UTC
[Puppet Users] Downloading files to Puppet clients from HTTP Server
Hi, I was working on some puppet recipe and came to the need where i want to download a file from an HTTP server, usually i use the "file" resource type with the "source" parameter to push files to the clients, but in this situation i just need to download the file directly from the HTTP server to the puppet client. By any chance, does the "source" parameter supports HTTP URLs, if not then how can i do that in Puppet ? Thanks in advance -- 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.
Darren Chamberlain
2010-Aug-19 00:30 UTC
Re: [Puppet Users] Downloading files to Puppet clients from HTTP Server
* Ahmed El Gamil <ahmed at manhag.org> [2010/08/18 17:17]:> I was working on some puppet recipe and came to the need where i > want to download a file from an HTTP server, usually i use the > "file" resource type with the "source" parameter to push files to > the clients, but in this situation i just need to download the > file directly from the HTTP server to the puppet client. > > By any chance, does the "source" parameter supports HTTP URLs, if > not then how can i do that in Puppet ?I use a simple define + wget for this kind of thing: define download ($uri, $timeout = 300) { exec { "download $uri": command => "wget -q ''$uri'' -O $name", creates => $name, timeout => $timeout, require => Package[ "wget" ], } } Use it like: download { "/tmp/tomcat.tar.gz": uri => "http://www.ibiblio.org/pub/mirrors/apache/tomcat/tomcat-5/v5.5.30/bin/apache-tomcat-5.5.30.tar.gz", timeout => 900; } -- It''s a damn poor mind that can only think of one way to spell a word. -- 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.
Craig Dunn
2010-Aug-19 09:38 UTC
Re: [Puppet Users] Downloading files to Puppet clients from HTTP Server
> By any chance, does the "source" parameter supports HTTP URLs, if not > then how can i do that in Puppet ? > >Source currently only supports the "file" and "puppet" URI types, you could accomplish a few ways, one is with a simple exec.... exec { "wget http://myurl.com/file.txt -o /path/to/file.txt": creates => "/path/to/file.txt", } Having "creates" will ensure that it doesn''t run if the file already exists. Craig -- 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.
Patrick
2010-Aug-19 14:53 UTC
Re: [Puppet Users] Downloading files to Puppet clients from HTTP Server
On Aug 19, 2010, at 2:38 AM, Craig Dunn wrote:> > By any chance, does the "source" parameter supports HTTP URLs, if not > then how can i do that in Puppet ? > > > Source currently only supports the "file" and "puppet" URI types, you could accomplish a few ways, one is with a simple exec.... > > exec { "wget http://myurl.com/file.txt -o /path/to/file.txt": > creates => "/path/to/file.txt", > } > > Having "creates" will ensure that it doesn''t run if the file already exists. > > CraigJust to clarify, if the remote file is changed, the client will not know to redownload the remote file. Zsync might do what you want if you want the client''s file to change if the remote file changes. -- 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.