I have not tried this recently, but this was my process for building a base OS image that could I could self register to the chef server.
- Build base OS image
- Install Chef client:
a. As root : curl -L https://omnitruck.chef.io/install.sh | bash
b. Create directory /etc/chef , and /etc/chef/trusted_certs
c. Create file : /etc/client.rb
3. Copy validator certificate (my-org-validator.pem) to image. Make sure location is correct in client.rb file.
4. Copy server certificates from Chef Server to /etc/chef/trusted_certs
a. For hosted chef server, this would be:
Registration with Chef Server.
After deployment, a new instance can be registered with the Chef Server in a couple of ways.
- Execute “chef-client” with no parameters.
- Execute “chef-client –r list of roles/recipes
a. For example : chef-client –r recipe[mypgsql::default], role[mylinux]
Hope it helps.