使用 Chef 管理文件夹和文件



我尝试搜索有关此问题的类似问题,但找不到解决此问题的任何内容。

我对厨师很陌生,所以可能会弄错一些术语。请耐心等待。

我在厨师服务器上本地有一个 git 存储库,例如。 /var/my-code/

我想添加里面的所有文件和文件夹 /var/my-code/properties/节点主机上的/app/files/properties/

我计划这样做的一种方法是在 properties/files/default/<symlink> /var/my-code/properties/但是当我运行刀具上传时,这失败了,因为存储库位于厨师服务器上而不是工作站上。我在运行刀具上传时收到此错误。

Uploading properties     [0.1.0]
ERROR: The cookbook properties has one or more broken files
ERROR: This is probably caused by broken symlinks in the cookbook directory
ERROR: The broken file(s) are: files/default/properties

有了remote_directory(据我所知)没有添加文件夹路径(例如/var/my-code/properties/)作为源的选项。它期望文件/文件夹位于说明书中的/files 目录中。

这是我的食谱

remote_directory '/app/files/properties' do
  source 'properties'
  owner 'root'
  group 'root'
  mode '0755'
end

提前谢谢你。

Chef Server

上的 git 存储库不相关,Chef Server 仅通过自己的 API 与客户端交互。

你可能想要这样的东西:

git '/var/my-code' do
  repository 'http://mygitserver/my-code.git'
end
link '/app/files/properties' do
  to '/var/my-code/properties'
end

最新更新