I suspect the ".chef" directory is missing. Try this:
mkdir ~/.chef
How I setup my chef workstation
First download the admin and validation keys from my chef server
ssh myusername@chefserver sudo cat /etc/chef-server/admin.pem > ~/.chef/admin.pem
ssh myusername@chefserver sudo cat /etc/chef-server/chef-validator.pem > ~/.chef/chef-validator.pem
Reference these files when generating the ~/.chef/knife.rb file:
knife configure --server-url https://chefserver
--user admin
--key ~/.chef/admin.pem
--validation-client-name chef-validator
--validation-key ~/.chef/chef-validator.pem
Update: Chef server 12
Chef 12 no longer creates a default "admin" user. Instead you must create a user and associate it with an organisation.
Create a user called "myuser" and save the key:
ssh myusername@chefserver sudo chef-server-ctl user-create myuser myName mySurname [email protected] XXXXXX > ~/.chef/myuser.pem
Create an organisation called "demo" adding "myuser" as an admin and save the validator key:
ssh myusername@chefserver sudo chef-server-ctl org-create demo "Demo organisation" -a myuser > ~/.chef/demo-validator.pem
And generate the knife configuration file:
knife configure --server-url https://chefserver/organizations/demo
--validation-client-name demo-validator
--validation-key ~/.chef/demo-validator.pem
--user myuser
--key ~/.chef/myuser.pem
Finally, Chef 12 respects SSL certs. The following command creates a trust relationship:
knife ssl fetch
Alternatively, you can disable SSL cert validation:
echo "ssl_verify_mode :verify_none" >> ~/.chef/knife.rb
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…