Sha256: d54b2167e2d1125960063b1b6ffdf57dd5ee8ae85709862f15e936fa10d60fbd
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 KB
Contents
require 'capistrano-provisioning' Capistrano::Configuration.instance(:must_exist).load do on :before, "cluster_ensure", :only => ["run_bootstrap", "install_users", "preview_users"] desc "[Internal] Ensures that a cluster has been specified" task :cluster_ensure do @clusters = fetch(:clusters, false) unless @clusters abort("No cluster specified - please use one of '#{self.clusters.keys.join(', ')}'") end end # Will set up a 'cluster' role, that will be set by the current provision. set :servers, [] role(:cluster) { fetch(:clusters).collect(&:servers).flatten } desc "Runs the bootstrap comamnds on the cluster" task :run_bootstrap do @clusters.each do |cluster| abort "No bootstrap block given for '#{cluster.name}' cluster" unless cluster.bootstrap cluster.bootstrap.call end end desc "Installs the specified users on the cluster" task :install_users do @clusters.each do |cluster| cluster.install_users(user_list) end end task :preview_users do puts "The following users will be added: " @clusters.each do |cluster| cluster.preview_users(user_list) end end def user_list return [] if ENV["USERS"].nil? ENV["USERS"].split(/, ?/) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
capistrano-provisioning-0.0.8 | lib/capistrano-provisioning/recipes.rb |
capistrano-provisioning-0.0.7 | lib/capistrano-provisioning/recipes.rb |