如何使用capistrano将文件复制到一堆服务器

|| 我经常使用cap invoke来在一堆服务器上运行命令。我还想使用capistrano将单个文件推送到一堆服务器。 起初我以为PUT可以做到这一点,但是put可以让您为文件创建数据。我不想这样做,我只想将运行capistrano comand的计算机上的现有文件复制到其他计算机上。 如果我可以做这样的事情会很酷:
host1$ cap HOSTS=f1.foo.com,f2.foo.com,f3.foo.com COPY /tmp/bar.bin 
我希望这会将host1:/tmp/bar.bin复制到f1.foo.com:/tmp/bar.bin和f2.foo.com:/tmp/bar.bin和f3.foo.com:/tmp/巴宾 这种事情似乎非常有用,所以我确定必须有一种方法可以执行此操作...     
已邀请:
        
upload(from, to, options={}, &block)
上载操作将文件存储在当前任务所针对的所有服务器上的给定路径上。 如果以前使用过deploy:upload任务,那么您可能已经知道此方法的工作原理。它采用您要上载的资源的路径以及远程服务器上的目标路径。
desc \"Uploads CHANGELOG.txt to all remote servers.\"
task :upload_changelog do
  upload(\"#{RAILS_ROOT}/CHANGELOG.txt\", \"#{current_path}/public/CHANGELOG\")
end
资源     
        这会将所有文件上载到相应的服务器。   上限部署:上传FILES = abc,def     
        显示所有任务:
cap -T
cap deploy                # Deploys your project.
cap deploy:check          # Test deployment dependencies.
cap deploy:cleanup        # Clean up old releases.
cap deploy:cold           # Deploys and starts a `cold\'...
cap deploy:create_symlink # Updates the symlink to the ...
cap deploy:migrations     # Deploy and run pending migr...
cap deploy:pending        # Displays the commits since ...
cap deploy:pending:diff   # Displays the `diff\' since y...
cap deploy:rollback       # Rolls back to a previous ve...
cap deploy:rollback:code  # Rolls back to the previousl...
cap deploy:setup          # Prepares one or more server...
cap deploy:symlink        # Deprecated API.
cap deploy:update         # Copies your project and upd...
cap deploy:update_code    # Copies your project to the ...
cap deploy:upload         # Copy files to the currently...
cap deploy:web:disable    # Present a maintenance page ...
cap deploy:web:enable     # Makes the application web-a...
cap integration           # Set the target stage to `in...
cap invoke                # Invoke a single command on ...
cap multistage:prepare    # Stub out the staging config...
cap production            # Set the target stage to `pr...
cap shell                 # Begin an interactive Capist...
您可以使用:
cap deploy:upload
看到: https://github.com/capistrano/capistrano/wiki/Capistrano-Tasks#deployupload     
        没有
cap deploy:upload
的任何人都可以尝试使用
cap invoke
来拉文件而不是将其推入。例如:
cap invoke COMMAND=\'scp host.where.file.is:/path/to/file/there /target/path/on/remote`
    

要回复问题请先登录注册