To setup chef workstation

前端 未结 1 739
清酒与你
清酒与你 2020-12-12 06:14

Trying to setup chef workstation

knife configure -i

previous it worked but now its not working i am unable to create knife.rb it says the f

相关标签:
1条回答
  • 2020-12-12 06:37

    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
    
    0 讨论(0)
提交回复
热议问题