Module: Capistrano::Saucier::Recipes::ChefSolo

Defined in:
lib/saucier/recipes/chef_solo.rb

Class Method Summary collapse

Class Method Details

.load_into(configuration) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/saucier/recipes/chef_solo.rb', line 7

def self.load_into(configuration)
  configuration.load do
    _cset(:chef_ruby, "default")
    _cset(:chef_gemset, "global")
    _cset(:chef_solo_config, ".chef/solo.rb")
    _cset(:chef_node_config, ".chef/node.json")

    namespace :chef_solo do
      task :default do
        chef_solo.install
      end

      task :install do
        servers = find_servers_for_task(current_task)
        servers.each do |s|
          node_name = s.options[:node_name] || 'chef-node'
          command = []
          command << "cd #{current_release}"
          command << rvm_wrapper("rvmsudo env SSH_AUTH_SOCK=$SSH_AUTH_SOCK chef-solo -c #{current_release}/#{chef_solo_config} -j #{current_release}/#{chef_node_config} -N #{node_name}")
          run command.join(" && ")
        end
      end
    end
  end
end