Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure deploy task. #2

Merged
merged 1 commit into from
Jul 13, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions Rakefile
Original file line number Original file line Diff line number Diff line change
@@ -1,16 +1,27 @@
require 'rubygems' require 'rubygems'
require 'chef' require 'chef'


task :deploy do namespace :deploy do
puts "Updating roles:" task :default => :all
Dir.glob("roles/*.rb").each{|role_path| system("./bin/knife role from file #{role_path}")}
puts "Updating cookbooks:" desc 'Update chef server with roles and cookboks and deploy application'
system('./bin/knife cookbook upload -a') task :all => [:roles, :cookbooks, :application]
puts "Running chef-clients:"
system('./bin/knife ssh "role:*" -x deploy "sudo chef-client"') desc 'Push application code to all servers'
end task :application do
puts 'Running chef-clients:'
system('./bin/knife ssh "role:*" -x deploy "sudo chef-client"')
end


task :roles do desc 'Push roles to chef-server'
puts "Updating roles:" task :roles do
Dir.glob("roles/*.rb").each{|role_path| system("./bin/knife role from file #{role_path}")} puts 'Updating roles:'
end Dir.glob("roles/*.rb").each{|role_path| system("./bin/knife role from file #{role_path}")}
end

desc 'Push cookbooks to chef-server'
task :cookbooks do
puts 'Updating cookbooks:'
system('./bin/knife cookbook upload -a')
end
end