Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chef copy file (via remote_file?) from a windows share

Tags:

chef-infra

I had to copy some files to a windows host off of a windows share the other day. To my horror I realized there's no built in option for that:

  • remote_file doesn't accept a windows network share as a source
  • windows_package (from the windows cookbook) is only for running installers (.msi / .exe etc) ... ?

Is the only solution to this writing a custom helper library that does the file copy? This sounds like core functionality that should exist within remote_file. Am I missing something here or does Chef indeed have no built-in option for a simple file copy off of windows shares?

like image 995
keftes Avatar asked Feb 12 '23 21:02

keftes


1 Answers

To get a file from a windows network share using remote_file, you just have to use the correct URL syntax (which is indeed a bit non-obvious):

remote_file "foo" do
  source "file:////server/path/to/file"
  path "/path/to/local/file"
end

That way, it works even when when copying stuff from CIFS shares.

like image 78
Holger Just Avatar answered Mar 05 '23 22:03

Holger Just