I'm trying to get a grasp on chef and for the life of me I cannot find how cook books are run
If I have the file structure
chef-repo
├── cookbooks
│ └── test
│ ├── attributes
│ │ ├── default.rb
│ │ └── test.rb
│ ├── files...
│ ├── metadata.rb
│ ├── recipes
│ │ ├── default.rb
│ │ └── test.rb
│ └── templates...
├── roles
│ └── starter.rb
└── Vagrantfile
How are the attributes loaded and in what order? eg it loads all the attributes (default.rb and test.rb) with default.rb always loaded first
How are the recipes run? eg only default.rb is run and everything , or all are run in alphabetical order.
I've found http://docs.opscode.com/essentials_nodes_chef_run.html but it doesn't explain cookbook execution only node level execution. Any resources or links to chef docs would be appreciated
Cheers
Recipes are run in the order they occur in the runlist. Only recipes that occur in the run list will be executed (plus any recipes that are included in place using include_recipe
. Note that each recipe will only run once, even if it occurs multiple times in the runlist.
Attribute files from cookbooks are loaded in this order:
depends
in metadata.rb
attributes/default.rb
attributes
files in alphabetical order.Note that all attribute files in a cookbook are loaded, regardless of their name. Only attributes of cookbooks which either explicitly occur in the resolved runlist (i.e. recipes loaded by roles or explicit inclusion into the runlist) or which are dependencies of their cookbooks will be loaded.