After reading this article, not all the steps applied in my case. I’ve pasted the steps I had to take on my system, to get chef-dk 0.11.0-1_amd64.deb to work on the listed CentOs.
Steps to configure chef-server locally
- use this kitchen file:
- with this recipe:
- do a kitchen converge
- open https://192.168.33.7 in your browser
- login as admin/p@assw0rd1
- change password
- create user geo with whatever password, make him an admin
- on the screen there will be a private key shown, copy that and save it locally to a file named geo.pem
- in chef-repo create a .chef folder
- copy geo.pem there
- we need to copy the chef-validator from the host scp root@192.168.33.7:/etc/chef-server/chef-validator.pem .
- add a new entry to /etc/hosts with the following content:
192.168.33.7 default-centos65
- in .chef, create a file called knife.rb with the following content:
- the content of .chef should be:
.chef/ geo.pem knife.rb chef-validator.pem
- test that server is accessible:
$ knife client list chef-validator chef-webui
Potential problems you may encounter
- I encountered this initially, when running knife client list
➜ chef-repo git:(master) ✗ knife client list ERROR: SSL Validation failure connecting to host: default-centos65.vagrantup.com - hostname "default-centos65.vagrantup.com" does not match the server certificate ERROR: SSL Error connecting to https://default-centos65.vagrantup.com/clients, retry 1/5 ERROR: SSL Validation failure connecting to host: default-centos65.vagrantup.com - hostname "default-centos65.vagrantup.com" does not match the server certificate
- fix for it was to run knife ssl check, where I saw the following:
➜ chef-repo git:(master) ✗ knife ssl check Connecting to host default-centos65.vagrantup.com:443 ERROR: The SSL cert is signed by a trusted authority but is not valid for the given hostname ERROR: You are attempting to connect to: 'default-centos65.vagrantup.com' ERROR: The server's certificate belongs to 'default-centos65'
- then, I just changed the entry from default-centos65.vagrantup.com to default-centos65 in /etc/hosts
- also, I went in knife.rb and I changed chef_server_url from:
chef_server_url "https://default-centos65.vagrantup.com:443"
to
chef_server_url "https://default-centos65:443"
- next, run another knife ssl check, and you should see this output:
➜ chef-repo git:(master) ✗ knife ssl check Connecting to host default-centos65:443 Successfully verified certificates from `default-centos65'