Chef-Solo

Running Chef cookbooks without a Chef Server.

solo.rb tell chef-solo where to find the cookbooks :

root = File.absolute_path(File.dirname(__FILE__))

file_cache_path root
cookbook_path root + '/cookbooks'

attributes.json centralize the node attributes :

{
	"sublime_text": {
		"users": [
			"levasju1"
		]
	},
	"run_list": ["recipe[workstation::default]"]
}

Why run :

sudo chef exec chef-solo -W -c solo.rb -j attributes.json 
sudo chef exec chef-solo -W -c solo.rb -j attributes.json 
[sudo] password for levasju1: 
Starting Chef Client, version 13.6.4
resolving cookbooks for run list: ["workstation::default"]
Synchronizing Cookbooks:
  - workstation (0.1.0)
  - sublime_text (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 16 resources
Recipe: workstation::default
  * apt_update[] action periodic
    - Would update new lists of packages
  * apt_package[vim] action install (up to date)
  * apt_package[git] action install (up to date)
  * apt_package[meld] action install
    - Would install version 3.16.1-1~ubuntu16.04.1 of package meld
Recipe: sublime_text::debian
  * apt_package[apt-transport-https] action install (up to date)
  * bash[import sublime-text repo key] action run
    - Would execute "bash"  "/tmp/chef-script20171206-31266-d9pe4k"
  * template[/etc/apt/sources.list.d/sublime-text.list] action create
    - Would update content in file /etc/apt/sources.list.d/sublime-text.list from fb7e72 to eec72a
    (no diff)
  * bash[apt-get update] action run
    - Would execute "bash"  "/tmp/chef-script20171206-31266-x4hwq"
  * apt_package[sublime-text] action install (up to date)
  * directory[/home/levasju1/.config/sublime-text-3/Installed Packages] action create (up to date)
  * remote_file[/home/levasju1/.config/sublime-text-3/Installed Packages/Package Control.sublime-package] action create
    - Would change mode from '0664' to '0644'
  * directory[/home/levasju1/.config/sublime-text-3/Packages/User] action create (up to date)
  * template[/home/levasju1/.config/sublime-text-3/Packages/User/Package Control.sublime-settings] action create (up to date)
Recipe: sublime_text::syntax-specific
  * template[/home/levasju1/.config/sublime-text-3/Packages/User/Ruby.sublime-settings] action create
    - Would create new file /home/levasju1/.config/sublime-text-3/Packages/User/Ruby.sublime-settings
    - Would change mode from '' to '0644'
    - Would change owner from '' to 'levasju1'
    - Would change group from '' to 'levasju1'
  * template[/home/levasju1/.config/sublime-text-3/Packages/User/Ruby Haml.sublime-settings] action create
    - Would create new file /home/levasju1/.config/sublime-text-3/Packages/User/Ruby Haml.sublime-settings
    - Would change mode from '' to '0644'
    - Would change owner from '' to 'levasju1'
    - Would change group from '' to 'levasju1'
  * template[/home/levasju1/.config/sublime-text-3/Packages/User/JSON.sublime-settings] action create
    - Would create new file /home/levasju1/.config/sublime-text-3/Packages/User/JSON.sublime-settings
    - Would change mode from '' to '0644'
    - Would change owner from '' to 'levasju1'
    - Would change group from '' to 'levasju1'
[2017-12-06T17:44:25-05:00] WARN: In why-run mode, so NOT performing node save.
[2017-12-06T17:44:25-05:00] WARN: In why-run mode, so NOT performing node save.

Running handlers:
Running handlers complete
Chef Client finished, 9/16 resources would have been updated