定期运行chef-client:命令行错误

时间:2018-08-17 09:33:32

标签: chef devops

我正在尝试遵循Chef教程(版本https://learn.chef.io)。

我将CentOS 7用于我的工作站环境以及目标节点。

它们是按照教程中的建议使用“ Vagrant”框生成的。

我正在使用由Chef托管的Chef服务器(版本https://manage.chef.io/login)。

Al的工作正常,我能够将食谱从工作站部署到目标节点,并在Chef Server上上传食谱。

现在,我正尝试定期调整厨师客户,并按照https://learn.chef.io/modules/manage-a-node-chef-server/rhel/hosted/run-chef-client-periodically#/教程中的建议定义了角色web

我正在尝试从命令行使用此命令运行chef-client

 $ knife ssh 'role:web' 'sudo chef-client' --ssh-user root --ssh-password 'vagrant' --attribute 192.168.44.10

其中属性值是我的目标节点IP地址,默认情况下,我的Vagrant环境是用户名和密码

我得到的是以下

[vagrant@localhost roles]$ knife ssh 'role:web' 'sudo chef-client' --ssh-user root --ssh-password 'vagrant' --attribute 192.168.44.10
localhost [2018-08-17T09:25:45+00:00] WARN: *****************************************
localhost [2018-08-17T09:25:45+00:00] WARN: Did not find config file: /etc/chef/client.rb, using command line options.
localhost [2018-08-17T09:25:45+00:00] WARN: *****************************************
localhost Starting Chef Client, version 14.2.0
localhost
localhost Running handlers:
localhost [2018-08-17T09:25:56+00:00] ERROR: Running exception handlers
localhost Running handlers complete
localhost [2018-08-17T09:25:56+00:00] ERROR: Exception handlers complete
localhost Chef Client failed. 0 resources updated in 10 seconds
localhost [2018-08-17T09:25:56+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
localhost [2018-08-17T09:25:56+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
localhost [2018-08-17T09:25:56+00:00] FATAL: Errno::ENOENT: No such file or directory @ rb_sysopen - /etc/chef/chef_guid

stacktrace的内容如下:

Errno::ENOENT: No such file or directory @ rb_sysopen - /etc/chef/chef_guid
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-14.2.0/lib/chef/client.rb:1012:in `initialize'
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-14.2.0/lib/chef/client.rb:1012:in `open'
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-14.2.0/lib/chef/client.rb:1012:in `generate_guid'
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-14.2.0/lib/chef/client.rb:262:in `run'
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-14.2.0/lib/chef/application.rb:303:in `run_with_graceful_exit_option'
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-14.2.0/lib/chef/application.rb:279:in `block in run_chef_client'
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-14.2.0/lib/chef/local_mode.rb:44:in `with_server_connectivity'
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-14.2.0/lib/chef/application.rb:261:in `run_chef_client'
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-14.2.0/lib/chef/application/client.rb:441:in `run_application'
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-14.2.0/lib/chef/application.rb:66:in `run'
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-14.2.0/bin/chef-client:26:in `<top (required)>'
/bin/chef-client:272:in `load'
/bin/chef-client:272:in `<main>'

有什么建议吗?

0 个答案:

没有答案