厨师从本地目录中提取 [英] Chef to pull from local directory

查看:66
本文介绍了厨师从本地目录中提取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,Chef节点中的Chef客户端从拥有更改的Chef服务器中拉取.如何将厨师客户端指向具有我的更改的本地文件夹.大厨Solo会帮忙

Usually Chef client in chef node pulls from chef server which has the changes. How do I point chef client to a local folder which has my changes. Will Chef Solo help

推荐答案

我认为您的做法正确.我们可以使用 chef-solo 在本地制作食谱,然后直接在节点上执行.

I think you are on the right track. We can use chef-solo to have cookbooks locally and execute them directly on the nodes.

让我们以一个示例节点 node1.example.net 为例,我们可以在其中包含一个配置文件 solo.rb (可以是任何名称).

Let's take an example node node1.example.net, we can have a config file in it solo.rb (can be any name).

solo.rb

cookbook_path '/home/user/.chef/cookbooks'
file_cache_path '/home/user/.chef/cache'
role_path '/home/user/.chef/roles'
data_bag_path '/home/user/.chef/databags'

如果我们此时运行 chef-solo

chef-solo -c /home/user/.chef/solo.rb

不会有 run_list ,因此不会发生任何事情,但是会在 .chef/nodes <节点名称> .json >目录,例如 node1.example.net.json .

There will no run_list so nothing will happen, but a <node name>.json will be created in the .chef/nodes directory, like node1.example.net.json.

现在,我们可以将食谱存储在/home/user/.chef/cookbooks 下,并将适当的食谱添加到 node1.example的 run_list 中..net.json 文件.

Now we can store the cookbooks under /home/user/.chef/cookbooks, and add the appropriate cookbooks in the run_list of the node1.example.net.json file.

或者我们可以提供带有所需运行清单的可选 .json 文件.类似于 example.json :

Or we can supply an optional .json file with the runlist we need. Something like example.json:

{
  "name": "tftest-devops01.headquarters.healthedge.com",
  "chef_environment": "_default",
  "json_class": "Chef::Node",
  // some lines removed
  "run_list": [
    "recipe[my_cookbook]"
  ]
}

然后运行为:

chef-solo -c solo.rb -j example.json

零零食

还有一个厨师零,它可以帮助运行本地"广告.(内存中)Chef服务器,以模仿Chef服务器的功能,使我们能够执行 knife 操作.

There is also a chef-zero, which can help run a "local" (in-memory) Chef server to mimic Chef server functionality allowing us to perform knife operations.

这篇关于厨师从本地目录中提取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆