Chef尝试创建客户端时遇到错误

时间:2018-04-20 00:25:49

标签: chef

描述 Chef尝试创建客户端“rh36”时遇到错误

ChefDK版本 Chef Development Kit版本:2.4.17 chef-client版本:13.6.4 交货版本:master(73ebb72a6c42b3d2ff5370c476be800fee7e5427) berks版本:6.3.1 厨房版:1.19.2 inspec版本:1.45.13

平台版本 CentOS7 Linux rh36 3.10.0-693.el7.x86_64#1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU / Linux

复制案例 刀具bootstrap rh36 --ssh-user lijun --sudo --identity-file~ / .ssh / id_rsa --node-name rh36 - run-list'scheme [learn_chef_httpd]'

#Bootstrap输出
lijun@rh66:~/learn-chef/.chef$ knife bootstrap rh36 --ssh-user lijun --sudo --identity-file ~/.ssh/id_rsa --node-name rh36 --run-list ‘recipe[learn_chef_httpd]’
Doing old-style registration with the validation key at /home/lijun/learn-chef/.chef/learnchef-validator.pem…
Delete your validation key in order to use your user credentials instead

Connecting to rh36
rh36 knife sudo password:
Enter your password:
rh36
rh36 -----> Installing Chef Omnibus (-v 13)
rh36 downloading https://omnitruck-direct.chef.io/chef/install.sh
rh36 to file /tmp/install.sh.1643/install.sh
rh36 trying wget…
rh36 el 7 x86_64
rh36 Getting information for chef stable 13 for el…
rh36 downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=13&p=el&pv=7&m=x86_64
rh36 to file /tmp/install.sh.1648/metadata.txt
rh36 trying wget…
rh36 sha1   f69e475eb3bcdeefe761462f05cbf7c7281270ae
rh36 sha256 39227d13e5ca2ae023627ad63c56a073b7fecf1a68030915b11ce55e9692c214
rh36 url    https://packages.chef.io/files/stable/chef/13.8.5/el/7/chef-13.8.5-1.el7.x86_64.rpm
rh36 version    13.8.5
rh36 downloaded metadata file looks valid…
rh36 downloading https://packages.chef.io/files/stable/chef/13.8.5/el/7/chef-13.8.5-1.el7.x86_64.rpm
rh36 to file /tmp/install.sh.1648/chef-13.8.5-1.el7.x86_64.rpm
rh36 trying wget…
rh36 Comparing checksum with sha256sum…
rh36 Installing chef 13
rh36 installing with rpm…
rh36 warning: /tmp/install.sh.1648/chef-13.8.5-1.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY
rh36 Preparing… ################################# [100%]
rh36 Updating / installing…
rh36 1:chef-13.8.5-1.el7 ################################# [100%]
rh36 Thank you for installing Chef!
rh36 Starting the first Chef Client run…
rh36 Starting Chef Client, version 13.8.5
rh36 Creating a new client identity for rh36 using the validator key.
rh36
rh36 ================================================================================
rh36 Chef encountered an error attempting to create the client “rh36”
rh36 ================================================================================
rh36
rh36 Authentication Error:
rh36 ---------------------
rh36 Failed to authenticate to the chef server (http 401).
rh36
rh36 Server Response:
rh36 ----------------
rh36 Failed to authenticate as ‘learnchef’. Ensure that your node_name and client key are correct.
rh36
rh36 Relevant Config Settings:
rh36 -------------------------
rh36 chef_server_url “https://rh56/organizations/learnchef”
rh36 validation_client_name “learnchef”
rh36 validation_key “/etc/chef/validation.pem”
rh36
rh36 If these settings are correct, your validation_key may be invalid.
rh36
rh36 System Info:
rh36 ------------
rh36 chef_version=13.8.5
rh36 ruby=ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]
rh36 program_name=chef-client worker: ppid=1643;start=22:36:29;
rh36 executable=/opt/chef/bin/chef-client
rh36
rh36
rh36 Running handlers:
rh36 [2018-04-12T22:36:31-04:00] ERROR: Running exception handlers
rh36 Running handlers complete
rh36 [2018-04-12T22:36:31-04:00] ERROR: Exception handlers complete
rh36 Chef Client failed. 0 resources updated in 01 seconds
rh36 [2018-04-12T22:36:31-04:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
rh36 [2018-04-12T22:36:31-04:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
rh36 [2018-04-12T22:36:31-04:00] ERROR: 401 “Unauthorized”
rh36 [2018-04-12T22:36:31-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

环境:

主机名:rh56 角色:厨师服务器

主机名:rh66 角色:厨师工作站

主机名:rh36 角色:Linux服务器(CentOS 7)

rh66上的Knife.rb: lijun @ rh66:〜/ learn-chef / .chef $ cat knife.rb

current_dir = File.dirname(__FILE__)
log_level                 :info
log_location              STDOUT
node_name                 "lijun"
client_key                "#{current_dir}/lijun.pem"
validation_client_name   'learnchef'
validation_key           "#{current_dir}/learnchef-validator.pem"
chef_server_url           "https://rh56/organizations/learnchef"
cache_type               'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path             ["#{current_dir}/../cookbooks"]

lijun @ rh66:〜/ learn-chef / .chef $ knife ssl check

连接到主机rh56:443

成功验证了`rh56'

的证书

lijun @ rh66:〜/ learn-chef / .chef $ 刀客户名单

learnchef-验证

  • lijun @ rh66:〜/ learn-chef / .chef $ knife bootstrap rh36 --ssh-user lijun --sudo -P hotmail_1 --identity-file~ / .ssh / id_rsa --node-name rh36 - 运行列表'recipe [learn_chef_httpd]'

    此命令已成功下载并安装了Chef,但在使用验证密钥为rh36创建新客户端标识时出现身份验证错误。

    请分享任何想法来解决此问题。感谢。

  • 1 个答案:

    答案 0 :(得分:0)

    您的验证客户端名称设置为learnchef,这非常不寻常。它通常是$orgname-validator$orgname-validation,具体取决于Chef Server的版本。如果您knife在本地工作,可以查看knife client list