To run single recipe using chef-solo
> chef-solo -c /opt/chef/repo/config/solo.rb -o my_cookbook::recipe
To run the single reciepe in same machine
> chef-apply hello.rb
To generate the cookbook standard structure
> chef generate cookbook learn_chef_httpd
> knife cookbook create smartmontools -r md
To generate the template file in cookbook
> chef generate template learn_chef_httpd index.html
To run the cookbook in local mode
> sudo chef-client --local-mode --runlist ‘recipe[learn_chef_httpd]’
To download the cookbooks from market place
> knife cookbook site download learn_chef_httpd
> knife cookbook site install learn_chef_httpd
To Upload the cookbooks to chef server
> knife cookbook upload learn_chef_httpd
> knife cookbook upload -a
To bootstrap a nodes
> knife bootstrap {{address}} --ssh-user {{user}} --ssh-password '{{password}}' --sudo --use-sudo-password --node-name node1 --run-list 'recipe[learn_chef_apache2]'
> knife bootstrap uvo1t75faaktzc532w6.vm.cld.sr -x root -P Br356YS0iy –sudo –node-name firefox
> knife bootstrap 123.45.6.789 -x username -P password –sudo
To see the list of nodes
>knife node list
To edit the node run list
> knife node edit name_of_node
To see the info about each nodes
> knife node show node1
Run the cooksbooks on nodes
> knife ssh {{address}} 'sudo chef-client' --manual-list --ssh-user {{user}} --ssh-password '{{password}}'
> ssh username@ipadddress -i mycredentials.pem sudo chef-client
To add the run list to the nodes.
knife node run_list add C2445575914.domain 'recipe[hptrain]'
knife node run_list set test-node '''recipe[iptables]''' [Windows - Powershell]
knife node run_list set test-node 'recipe[iptables]' [Windows - Command]
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services — all in one place.
Explore Hospitals