我刚刚在Chef的网站上完成了安装厨师服务器教程,使用我的厨师服务器(t2.medium Ubuntu 16.04 AMI)的ec2实例,以及运行Ubuntu 16.04的我的工作站的笔记本电脑。
看来,我成功地成立了一个厨师工作站和厨师服务器。 但是,我的'user.pem'键没有被定位。 这是市集,因为我的厨师钥匙已经成功地从我的厨师服务器拉到我的厨师工作站使用'scp'。 我可以在我的工作站的厨师回购目录中看到他们。
任何人都可以帮忙弄清楚为什么我的Pem键没有被find?
从我的厨师工作站:
~/chef-repo/
我运行:
knife ssl fetch
我得到:
WARNING: Certificates from ec2-XX-XX-XXX-XXX.us-west-1.compute.amazonaws.com will be fetched and placed in your trusted_cert directory (/home/user/chef-repo/.chef/trusted_certs). Knife has no means to verify these are the correct certificates. You should verify the authenticity of these certificates after downloading. Adding certificate for ec2-XX-XX-XXX-XXX_us-west-1_compute_amazonaws_com in /home/user/chef-repo/.chef/trusted_certs/ec2-XX-XX-XXX-XXX_us-west-1_compute_amazonaws_com.crt
所以现在我有一个:
'/chef-repo/.chef/trusted_certs/ec2-52-53-255-252_us-west-1_compute_amazonaws_com.crt'
文件如预期。
接下来我运行:
knife ssl check
我得到:
Connecting to host ec2-XX-XX-XXX-XXX.us-west-1.compute.amazonaws.com:443 Successfully verified certificates from `ec2-XX-XX-XXX-XXX.us-west-1.compute.amazonaws.com'
但是当我运行:
knife client list
我得到:
WARN: Failed to read the private key /user.pem: #<Errno::ENOENT: No such file or directory @ rb_sysopen - /user.pem> Your private key could not be loaded from /user.pem Check your configuration file and ensure that your private key is readable
我的'knife.rb'。 设置是:
log_level :info log_location STDOUT node_name "user" client_key "#{current_dir}/user.pem" validation_client_name "myorg_shortname-validator" validation_key "#{current_dir}/myorg_shortname-validator.pem" chef_server_url "https://ec2-XX-XX-XXX-XXX.us-west-1.compute.amazonaws.com/organizations/myorg_shortname" syntax_check_cache_path "#{ENV['HOME']}/.chef/syntaxcache" cookbook_path ["#{current_dir}/../cookbooks"]
在我的主服务器上,我的/ etc / hosts和/ etc / hostname设置都是:
ip-XXX-XX-XX-XX.us-west-1.compute.internal
奇怪的是,我不得不在'knife.rb'中设置'chef_server_url'来:
ec2-XX-XX-XXX-XXX_us-west-1_compute_amazonaws_com
而不是:
ip-XXX-XX-XX-XX.us-west-1.compute.internal
否则它不会取我的钥匙
我错过了什么?
我希望我没有浪费任何人的时间。 我发现在我的'knife.rb'设置的顶部的问题。 当我花费太多时间在某些事情上时,会发生什么情况,真的需要rest一下。
我错过了“knife.rb”顶部的目录path:
current_dir = File.dirname(__FILE__)
所以我的'knife.rb'现在看起来像这样:
current_dir = File.dirname(__FILE__) log_level :info log_location STDOUT node_name 'user' client_key "#{current_dir}/user.pem" validation_client_name 'digitalocean-validator' validation_key "#{current_dir}/myorg-validator.pem" chef_server_url 'https://ec2-XX-XX-XXX-XXX.us-west-1.compute.amazonaws.com/organizations/myorg' cache_type 'BasicFile' cache_options( :path => "#{ENV['HOME']}/.chef/checksums" ) cookbook_path ["#{current_dir}/../cookbooks"]
希望我至less可以帮助那些可能已经经历过这样的人。 保重。