Chef- Cookbook

 

Create a New Cookbook :

$ knife generate cookbook apache

$ ls -la cookbooks/apache   --- explore the cookbook

Edit default Recipe :

Path : cookbooks/apache/recipes/default.rb



Upload Cookbook to Chef Server :

$ knife cookbook upload apache

The Run List

The Run List is the ordered set of recipes and roles that the Chef-client will execute on a node
  • Recipes are specified by “recipe[name]”
  • Roles are specified by “role[name]”
Add apache recipe to test node’s run list : 

$ knife node run_list add node1 "recipe[apache]"

Run Chef-client From Node : $ sudo chef-client

Cookbooks contain Recipes & Supporting Files :


List Nodes : $ knife node list

List Clients : $ knife client list

Show Node Details : $ knife node show node1

Show all Node Attributes : $ knife node show node1 -l

Show only FQDN Attributes : $ knife node show node1 -a fqdn

Use Search to Find the same Data :  $ knife search node "*:*" -a fqdn

Comments

Popular posts from this blog

Terraform

Scrum Master Interview help - Bootcamp

Kubernetes