使用Chef

时间:2016-05-20 04:36:50

标签: chef chef-recipe

我已尝试在此问题上搜索类似的问题,但无法解决此问题。

我对Chef很新,所以可能会有一些术语不正确。请耐心等待。

我在厨师服务器上本地有一个git repo,例如。 /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/等文件夹路径作为源。它希望文件/文件夹位于cookbook的/ files目录中。

这是我的食谱

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

提前谢谢。

1 个答案:

答案 0 :(得分:0)

Chef服务器上的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