Use ftp as source for file

129 views
Skip to first unread message

Илья Захаров

unread,
Dec 26, 2014, 6:32:05 AM12/26/14
to puppet...@googlegroups.com
Hi there! I want to get files which are missing on the nodes on FTP

So for test i write something like this:

file { '/home/user1/conf/tempconf1.xml' :
      ensure => present,
      source => 'ftp:///192.168.209.23/temp',
}

and i have a error "Cannot use URLs of type 'ftp' as source for fileserving"

So what does i need to do that i can use "http" or "ftp" source for files ??

Thanks!

 

Felix Frank

unread,
Dec 26, 2014, 2:42:42 PM12/26/14
to puppet...@googlegroups.com
Hi,

support for HTTP is a long standing feature request.

https://tickets.puppetlabs.com/browse/PUP-1072

It's currently work in progress, you can expect it in version 4.1,
perhaps even 4.0. As for FTP, I'm a little doubtful that support will go
mainline any time soon, or at all.

In the meantime, a common workaround can be implemented using `exec`,
roughly:

$file = '/home/user1/conf/tempconf1.xml'
$url = 'ftp://192.168.209.23/temp'
exec {
"get-$file":
command => "/path/to/ftpclient $url -o $file",
creates => $file,
}

Please note that the URL should use but two slashes after the colon,
seeing as it includes a host address.

HTH,
Felix

Martin Alfke

unread,
Dec 27, 2014, 9:49:31 AM12/27/14
to puppet...@googlegroups.com
Hi,

instead of using exec’s you might want to dig into existing modules and their defines, types and providers:

https://github.com/camptocamp/puppet-archive
https://github.com/maestrodev/puppet-wget

When using exec resources you have to ensure by yourself that the exec runs only in case of changes needed.
An exec should not get executed on every puppet agent run.

hth,

Martin
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/549DBA29.1090105%40Alumni.TU-Berlin.de.
> For more options, visit https://groups.google.com/d/optout.

巨海录

unread,
Dec 30, 2014, 9:04:12 PM12/30/14
to puppet...@googlegroups.com
recommend this existing modules:

https://github.com/nanliu/puppet-staging

在 2014年12月27日星期六UTC+8下午10时49分31秒,Martin Alfke写道:
Reply all
Reply to author
Forward
0 new messages