How To Setup a Chef 12 on CentOS 7 / RHEL 7
Bootstrapping a New Node with Knife:
Bootstrapping a node is a process of installing chef-client on a target machine so that it can run as a chef-client node and communicate with the chef server.
From the workstation, you can bootstrap the node either by using the node’s root user, or a user with elevated privileges.
knife bootstrap chefclient.itzgeek.local -x root -P pass --sudo
Important options:
-x: The ssh username
-P: The ssh password
-p: The ssh port
-N: Set your chef-client node name. Leaving this out will usually make hostname being used as the chef-client node name.
–sudo: If the user name on the node will need to use sudo to perform administrative actions, then use this flag. Note: It will prompt you for sudo the sudo password.
Since I didn’t use -N in the command, the hostname will become chef node name.
Output:
Doing old-style registration with the validation key at /root/chef-repo/.chef/itzgeek-validator.pem... Delete your validation key in order to use your user credentials instead Connecting to chefclient.itzgeek.local chefclient.itzgeek.local -----> Installing Chef Omnibus (-v 12) chefclient.itzgeek.local downloading https://omnitruck-direct.chef.io/chef/install.sh chefclient.itzgeek.local to file /tmp/install.sh.2626/install.sh chefclient.itzgeek.local trying curl... chefclient.itzgeek.local el 7 x86_64 chefclient.itzgeek.local Getting information for chef stable 12 for el... . . . . . .chefclient.itzgeek.local [2016-11-12T19:24:36-05:00] WARN: Node chefclient.itzgeek.local has an empty run list. chefclient.itzgeek.local Converging 0 resources chefclient.itzgeek.local chefclient.itzgeek.local Running handlers: chefclient.itzgeek.local Running handlers complete chefclient.itzgeek.local Chef Client finished, 0/0 resources updated in 05 seconds
Once the bootstrapping is complete, list down the nodes using the following command.
knife node list
Output:
chefclient.itzgeek.local
Get the client node details.
knife client show chefclient.itzgeek.local
Output:
admin: false chef_type: client name: chefclient.itzgeek.local validator: false
That’s All for now. We will soon meet again with another post on creating chef cookbooks.