我有一本厨师食谱(适用于 apache2)。它无法在一个节点上工作。所以我试图调整它并更新它,但节点似乎没有下载新版本。我已经能够将所有内容从我的本地机器上传到厨师服务器knife upload .
,成功,并打印出它上传了我更改的 apache2 食谱位。
当我chef-client
在节点上手动运行(以 root 身份)时,我可以看到它与服务器联系,获取运行列表等。但是,其中的配方文件/var/cache/chef/cookbooks/apache2
是旧文件。配方失败了(因为它没有我所做的更改)。
如何让节点上的 Chef 客户端使用 apache2 食谱的新更新版本?我需要在食谱中修改版本号吗(我没有这样做过)?
chef-client -l debug
输出:
[2015-01-30T10:51:31+01:00] DEBUG: Synchronizing cookbook apache2
[2015-01-30T10:51:31+01:00] DEBUG: Not storing cookbooks/apache2/recipes/mod_ldap.rb, as the cache is up to date.
[2015-01-30T10:51:31+01:00] DEBUG: Not storing cookbooks/apache2/recipes/mod_xsendfile.rb, as the cache is up to date.
[2015-01-30T10:51:31+01:00] DEBUG: Not storing cookbooks/apache2/recipes/mod_auth_openid.rb, as the cache is up to date.
[2015-01-30T10:51:31+01:00] DEBUG: Not storing cookbooks/apache2/recipes/mod_setenvif.rb, as the cache is up to date.
[2015-01-30T10:51:31+01:00] DEBUG: Not storing cookbooks/apache2/recipes/mod_python.rb, as the cache is up to date.
[2015-01-30T10:51:31+01:00] DEBUG: Not storing cookbooks/apache2/recipes/mod_authz_host.rb, as the cache is up to date.
[2015-01-30T10:51:31+01:00] DEBUG: Not storing cookbooks/apache2/recipes/mod_proxy_ajp.rb, as the cache is up to date.
[2015-01-30T10:51:31+01:00] DEBUG: Not storing cookbooks/apache2/recipes/mod_expires.rb, as the cache is up to date.
(lots of this for all files)
Run Code Online (Sandbox Code Playgroud)
我是厨师的新手,所以我可能犯了一个初学者的错误。
我能想到的几件事可能会对你有所帮助。
确认您上传的食谱版本是最新版本
食谱版本控制的一个常见问题是您可能正在本地修改食谱版本 1.0.0 并上传,但 Chef 服务器已将食谱版本 1.0.1 上传到它。在这种情况下,Chef 客户端通常会检索最新版本(除非另有说明)并且您的更改永远不会同步到本地缓存。
您可以通过以下方式在 Chef Server 上查看所有当前版本的食谱: knife cookbook show apache2
对此的一种解决方案是您提到的解决方案 - 将您的版本号增加到超出 Chef Server 上的版本号,即 1.0.2 并上传。
另一种方法是从 Chef Server 中删除任何其他 apache2 说明书,然后重新上传您想要的。这不需要任何版本号更新,最终结果是 Chef Server 将只有一个 apache2 说明书。
验证您的更改是否确实适用于 Chef Server
使用knife cookbook show apache2 <cookbook version> recipes default.rb
替换版本、路径和文件名 - 例如,如果您想查看名为 foo.erb 的模板:knife cookbook show apache2 0.1.0 templates foo.erb
此命令将从 Chef 服务器请求文件并在您的终端中显示输出。这是一种确定您所做的更改是否通过 上传的简单方法knife cookbook upload
。
除此之外,如果这没有帮助,添加knife
版本、chef-server
版本、chef-client
版本以及调试日志的详细信息knife cookbook upload apache2 -VV
将有助于进一步调试。
归档时间: |
|
查看次数: |
21026 次 |
最近记录: |