Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Restructure deploy task. #2

Merged
merged 1 commit into from

2 participants

@dmitriy-kiriyenko

Btw, why do you require 'chef' in a Rakefile? You only do system calls there. I was unsure if it's needed so didn't do a removal.

@iafonov iafonov merged commit 81f577b into iafonov:master
@iafonov
Owner

Thanks! I'll remove 'require' it isn't necessary.

@iafonov iafonov referenced this pull request from a commit
@iafonov Having fun with travis ci. #2 8e05008
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 13, 2012
  1. @dmitriy-kiriyenko

    Restructure deploy task.

    dmitriy-kiriyenko authored dmitriy-kiriyenko committed
This page is out of date. Refresh to see the latest.
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
Something went wrong with that request. Please try again.