To setup chef workstation

♀尐吖头ヾ 提交于 2019-11-28 14:44:40

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 myname@blah.com 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
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!