Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Restructure deploy task.

  • Loading branch information...
commit 8127a3e2050f6bc0c758ef75355ac4669b500b30 1 parent 91ba290
@dmitriy-kiriyenko dmitriy-kiriyenko authored dmitriy-kiriyenko committed
Showing with 23 additions and 12 deletions.
  1. +23 −12 Rakefile
View
35 Rakefile
@@ -1,16 +1,27 @@
require 'rubygems'
require 'chef'
-task :deploy do
- puts "Updating roles:"
- Dir.glob("roles/*.rb").each{|role_path| system("./bin/knife role from file #{role_path}")}
- puts "Updating cookbooks:"
- system('./bin/knife cookbook upload -a')
- puts "Running chef-clients:"
- system('./bin/knife ssh "role:*" -x deploy "sudo chef-client"')
-end
+namespace :deploy do
+ task :default => :all
+
+ desc 'Update chef server with roles and cookboks and deploy application'
+ task :all => [:roles, :cookbooks, :application]
+
+ desc 'Push application code to all servers'
+ task :application do
+ puts 'Running chef-clients:'
+ system('./bin/knife ssh "role:*" -x deploy "sudo chef-client"')
+ end
-task :roles do
- puts "Updating roles:"
- Dir.glob("roles/*.rb").each{|role_path| system("./bin/knife role from file #{role_path}")}
-end
+ desc 'Push roles to chef-server'
+ task :roles do
+ puts 'Updating roles:'
+ 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
Please sign in to comment.
Something went wrong with that request. Please try again.