Skip to content
Sean Escriva edited this page Jul 3, 2015 · 2 revisions

Provide a Batali file:

Batali.define do
  source 'https://supermarket.chef.io'
  cookbook 'postgresql'
end

and then run:

$ batali update

in the same directory. It will destroy your cookbooks directory by default. That's important, so let's repeat that for emphasis:

IT WILL DESTROY YOUR COOKBOOKS DIRECTORY BY DEFAULT

You've been warned.

Of course, you can make it not destroy your cookbooks directory by providing a different path. A better idea is to not use the cookbooks directory. Just ignore that sucker and let Batali do its thing. If you're using the infrastructure repository workflow you should already be ignoring the cookbooks directory anyway.

The Batali file

The Batali file declares your required cookbooks and optional version constraints. The origins, or sources to fetch these from are configurable.

Origins

Currently supported "origins":

  • RemoteSite
  • Path
  • Git
  • ChefServer

RemoteSite

This is simply a supermarket endpoint:

source 'https://supermarket.chef.io'

Multiple endpoints can be provided by specifying multiple source lines. An optional short name can also be provided.

source 'https://supermarket.chef.io', :name => 'opscode'
source 'https://cookbooks.example.com', :name => 'example'
ChefServer

This is a Chef Server endpoint:

chef_server 'https://chef-server.example.com'

It will use the node_name and client_key defined within the .chef/knife.rb configuration by default. To use the Chef Server URL defined within the configuration, just declare it with no arguments:

chef_server
Path

Paths are defined via cookbook entries:

cookbook 'example', path: '/path/to/example'

A short cut is also available when your Batali file is located at the root of the cookbook you want to add:

metadata

This will extract the name from the metadata file and automatically set the path '.'.

Git

Git sources are defined via cookbook entries:

cookbook 'example', git: 'git://git.example.com/example-repo.git', ref: 'master'

Common options

Batali provides the following common options, which are probably self explanatory:

Usage: batali [command] [options]
    -v, --version      Print version
    -h, --help         Display this help message.

Additionally each command may have it's own options, use the help flag pppto discover these as needed.

Commands