Sha256: 69e062a00abfc02180f9b0f5d950336251e216b6952871fc02839673cb30e47b
Contents?: true
Size: 1.67 KB
Versions: 1
Compression:
Stored size: 1.67 KB
Contents
Capistrano::Configuration.instance.load do namespace :puppet do set :puppet_target, '/home/vagrant/supply_drop' set :puppet_command, 'puppet' set(:puppet_lib) { "#{puppet_target}/modules" } set :puppet_parameters, 'puppet.pp' desc "installs puppet" task :bootstrap, :except => { :nopuppet => true } do run "#{sudo} apt-get update" run "#{sudo} apt-get install -y puppet" end desc "pushes the current puppet configuration to the server" task :update_code, :except => { :nopuppet => true } do find_servers_for_task(current_task).each do |server| rsync_cmd = "rsync -az --delete --exclude=.git -e 'ssh -i #{ssh_options[:keys]}' . #{server.user || user}@#{server.host}:#{puppet_target}/" logger.debug rsync_cmd system rsync_cmd end end desc "runs puppet with --noop flag to show changes" task :noop, :except => { :nopuppet => true } do update_code puppet :noop end desc "applies the current puppet config to the server" task :apply, :except => { :nopuppet => true } do update_code puppet :apply end end def puppet(command = :noop) puppet_cmd = "cd #{puppet_target} && #{sudo} PUPPETLIB=#{puppet_lib} puppet #{puppet_parameters}" flag = command == :noop ? '--noop' : '' outputs = {} begin run "#{puppet_cmd} #{flag}" do |channel, stream, data| outputs[channel[:host]] ||= "" outputs[channel[:host]] << data end logger.debug "Puppet #{command} complete." ensure outputs.each_pair do |host, output| logger.info "Puppet output for #{host}" logger.debug output, "#{host}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
supply_drop-0.1.0 | lib/supply_drop.rb |