当我用日志更改我的食谱时,我希望我的厨师 - 客户自动运行

时间:2014-09-16 12:01:40

标签: chef

我写了一本食谱来创建两个目录,我已经引导它,我可以看到在节点上创建了两个目录,我已经编辑了我的食谱,就像我已经添加了一个目录,我希望我的节点能够理解在cookbook中进行了更改,我必须运行chef-client。

为此我在我的运行列表中添加了chef-client :: default并编辑了 node["chef_client"]["interval"]属性为5分钟(300)。

但没有任何反应,我手动运行

chef-client -j /etc/chef/first-boot.json

但没有进展。

请帮助。

配方:

directory "/root/testfolder" do
  owner "root"
  group "root"
  mode 0755
  action :create
end

directory "/root/crontestfolder" do
  owner "root"
  group "root"
  mode 0755
  action :create
end
directory "/root/testfolder1" do
  owner "root"
  group "root"
  mode 0755
  action :create
end
directory "#{node['test']['filename']}" do
  owner "root"
  group "root"
  mode 0755
  action :create
end

日志

2014-09-16T12:32:37+00:00] WARN:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
SSL validation of HTTPS requests is disabled. HTTPS connections are still
encrypted, but chef is not able to detect forged replies or man in the middle
attacks.

To fix this issue add an entry like this to your configuration file:

```
  # Verify all HTTPS connections (recommended)
  ssl_verify_mode :verify_peer

  # OR, Verify only connections to chef-server
  verify_api_cert true
```

To check your SSL configuration, or troubleshoot errors, you can use the
`knife ssl check` command like so:

```
  knife ssl check -c /etc/chef/client.rb
```

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Starting Chef Client, version 11.12.2
resolving cookbooks for run list: ["test::default", "chef-client::default"]
Synchronizing Cookbooks:
  - chef_handler
  - windows
  - logrotate
  - cron
  - chef-client
  - test
Compiling Cookbooks...
Converging 11 resources
Recipe: test::default
  * directory[/root/testfolder] action create (up to date)
  * directory[/root/testfolder1] action create (up to date)
  * directory[/root/redis] action create (up to date)
Recipe: chef-client::init_service
  * directory[/var/run/chef] action create (up to date)
  * directory[/var/cache/chef] action create (up to date)
  * directory[/var/lib/chef] action create (up to date)
  * directory[/var/log/chef] action create (up to date)
  * directory[/etc/chef] action create (up to date)
  * template[/etc/init.d/chef-client] action create (up to date)
  * template[/etc/sysconfig/chef-client] action create (up to date)
  * service[chef-client] action enable (up to date)
  * service[chef-client] action start (up to date)

Running handlers:
Running handlers complete

Chef Client finished, 0/12 resources updated in 6.426809584 seconds

1 个答案:

答案 0 :(得分:1)

两个高概率:

  1. 您没有更新食谱的版本,并且您的服务器上的食谱已“冻结”。结果,你认为你正在推新的食谱,但你实际上并不是。

  2. 您正在更新版本,但您的环境已锁定到特定版本的食谱。

  3. 我要做的第一件事就是登录节点并检查/var/chef/cache/cookbooks/test/metadata.rb/var/chef/cache/coobooks/test/recipes/default.rb的内容。
    如果这些文件与您在开发框中的文件不匹配,那么上述问题之一几乎肯定是您的问题。如果它们符合您的预期,那么您就会遇到代码问题。