Getting started with chef
Set up a ubuntu node and run recipe on it
Predication:
- a running ubuntu node which accessiable via SSH from your labtop(workstation)
- cd to chef-repo directory.
Steps:
Bootstrap ububtu:
knife bootstrap IP_ADDRESS -x USERNAME -P PASSWORD --sudo
Verify the installation completed
knife client list
you will see your nodename in the client list
Download cookbooks from community site
knife cookbook site install getting-started
the cookbook named “getting-started” will be downloaded into chef-repo/cookbooks/
Upload the recipe to Hosted Chef so it is available for our nodes
knife cookbook upload getting-started
Add this new recipe to the new nodes run list
knife node run_list add NODENAME 'recipe[getting-started]'
Run the added recipe remotely via ssh
knife ssh name:NODENAME -x USERNAME -P PASSWORD "sudo chef-client" -a ipaddress
Runnig chef-client as a deamon
knife cookbook site install chef-client
knife cookbook upload chef-client
knife node run_list add NODENAME 'recipe[chef-client]'
knife ssh name:NODENAME -x USERNAME -P PASSWORD "sudo chef-client" -a ipaddress
Advanced tips:
- add recipe when bootstrap node
knife bootstrap IP_ADDRESS -r 'recipe[chef-client]' -x USERNAME -P PASSWORD --sudo