0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Makes Berkshelf more friendly to chef-solo by generating chef-solo folder layout
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 5.0
~> 0.14

Runtime

~> 3.1
 Project Readme

Berkshelf Solo

berkshelf-solo is an experimental project that acts as an adapter between Berkshelf and chef-solo, it works by generating a chef-solo style layout and configuration files when executing the berks vendor command.

Dependencies

  • Ruby 1.9+
  • Berkshelf 3
  • Berksfile

Installation

with bundler just add this line to your Gemfile and then execute bundle install

gem 'berkshelf-solo'

else you can manually install it by running

gem install berkshelf-solo

Usage

Compile cookbooks and prepare chef-solo layout

add this line at the top of your Berksfile

require 'berkshelf/solo'

after loading berkshelf-solo you will able to specify recipes that you want to install, for example lets say we want to install mysql server and client

cookbook 'mysql', :recipes => ["client", "server"]

run the berks vendor command and specify the cookbooks output folder, in this example we save the cookbooks under the chef/cookbooks directory inside our current directory

berks vendor chef/cookbooks

after the command was successfully run, look for the chef-solo configuration files and folders layout under the chef directory, should look something like this

$ ls -lrth chef/
drwxr-xr-x   2  wheel    68B Aug 14 15:52 roles
drwxr-xr-x   2  wheel    68B Aug 14 15:52 environments
drwxr-xr-x   2  wheel    68B Aug 14 15:52 data_bags
drwxr-xr-x  11  wheel   374B Aug 14 16:21 cookbooks
-rw-r--r--   1  wheel   289B Aug 14 17:42 solo.rb
-rw-r--r--   1  wheel   313B Aug 14 17:42 solo.json

$ cat chef/solo.json
{
  "run_list": [
    "recipe[mysql::client]",
    "recipe[mysql::server]"
  ]
}

You can also specify cookbook attributes using the :attibutes option

cookbook 'mysql', :recipes => ["client", "server"], :attributes => {
  "server_root_password"   => "password",
  "server_debian_password" => "password",
  "server_repl_password"   => "password"
}

and after the berks verndor command was successfully run you should see them inside the solo.json

{
  "run_list": [
    "recipe[nginx::default]",
    "recipe[mysql::default]",
    "recipe[mysql::server]"
  ],
  "mysql": {
    "server_root_password": "password",
    "server_debian_password": "password",
    "server_repl_password": "password"
  }
}

Install cookbooks using chef-solo on your target machine

Now to actually install the recipes using chef-solo you will need to run this command on your target machine ( inside the main project folder, on Berksfile location )

chef-client -c `pwd`/chef/solo.rb -j `pwd`/chef/solo.json`

Warranty

This software is provided “as is” and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.