Configuring Chef

Preparing Cookbooks

Lets prepare a cookbook.

Uploading a cookbook

  $ knife cookbook upload -a

Databags

Creating a databag

  $ knife data_bag create 'users'

Uploading a databag

  $ knife data_bag from file users path/to/data_bag/files

Bootstraping

Create a new node

In order to bootstrap a server to get and use chef, ensure that you have ssh access to your server already. You can define which user to login as using the –ssh-user command below.

  $ knife bootstrap <ip> -r 'recipe[blah::blah]','recipe[blah::blah]' --ssh-user
root

Modifying

Modifying a node’s runlist

First, find the node’s name

  $ knife node list

Setup editor environment

  $ export EDITOR=vim

Edit the node

  $ knife node edit NODENAME

Reference: