supply_drop 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/README +0 -0
  2. data/Rakefile +16 -0
  3. data/lib/supply_drop.rb +54 -0
  4. metadata +69 -0
data/README ADDED
File without changes
@@ -0,0 +1,16 @@
1
+ desc "clean"
2
+ task :clean do
3
+ rm_f Dir.glob("*.gem")
4
+ end
5
+
6
+ namespace :gem do
7
+ desc "build the gem"
8
+ task :build => :clean do
9
+ sh "gem build supply_drop.gemspec"
10
+ end
11
+
12
+ desc "push the gem"
13
+ task :push => :build do
14
+ sh "gem push #{Dir.glob("*.gem").first}"
15
+ end
16
+ end
@@ -0,0 +1,54 @@
1
+ Capistrano::Configuration.instance.load do
2
+ namespace :puppet do
3
+ set :puppet_target, '/home/vagrant/supply_drop'
4
+ set :puppet_command, 'puppet'
5
+ set(:puppet_lib) { "#{puppet_target}/modules" }
6
+ set :puppet_parameters, 'puppet.pp'
7
+
8
+ desc "installs puppet"
9
+ task :bootstrap, :except => { :nopuppet => true } do
10
+ run "#{sudo} apt-get update"
11
+ run "#{sudo} apt-get install -y puppet"
12
+ end
13
+
14
+ desc "pushes the current puppet configuration to the server"
15
+ task :update_code, :except => { :nopuppet => true } do
16
+ find_servers_for_task(current_task).each do |server|
17
+ rsync_cmd = "rsync -az --delete --exclude=.git -e 'ssh -i #{ssh_options[:keys]}' . #{server.user || user}@#{server.host}:#{puppet_target}/"
18
+ logger.debug rsync_cmd
19
+ system rsync_cmd
20
+ end
21
+ end
22
+
23
+ desc "runs puppet with --noop flag to show changes"
24
+ task :noop, :except => { :nopuppet => true } do
25
+ update_code
26
+ puppet :noop
27
+ end
28
+
29
+ desc "applies the current puppet config to the server"
30
+ task :apply, :except => { :nopuppet => true } do
31
+ update_code
32
+ puppet :apply
33
+ end
34
+ end
35
+
36
+ def puppet(command = :noop)
37
+ puppet_cmd = "cd #{puppet_target} && #{sudo} PUPPETLIB=#{puppet_lib} puppet #{puppet_parameters}"
38
+ flag = command == :noop ? '--noop' : ''
39
+
40
+ outputs = {}
41
+ begin
42
+ run "#{puppet_cmd} #{flag}" do |channel, stream, data|
43
+ outputs[channel[:host]] ||= ""
44
+ outputs[channel[:host]] << data
45
+ end
46
+ logger.debug "Puppet #{command} complete."
47
+ ensure
48
+ outputs.each_pair do |host, output|
49
+ logger.info "Puppet output for #{host}"
50
+ logger.debug output, "#{host}"
51
+ end
52
+ end
53
+ end
54
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: supply_drop
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Tony Pitluga
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-05-20 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: See http://github.com/pitluga/supply_drop
23
+ email: tony.pitluga@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - README
32
+ - Rakefile
33
+ - lib/supply_drop.rb
34
+ has_rdoc: true
35
+ homepage: http://github.com/pitluga/supply_drop
36
+ licenses: []
37
+
38
+ post_install_message:
39
+ rdoc_options: []
40
+
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ hash: 3
49
+ segments:
50
+ - 0
51
+ version: "0"
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ requirements: []
62
+
63
+ rubyforge_project:
64
+ rubygems_version: 1.4.1
65
+ signing_key:
66
+ specification_version: 3
67
+ summary: Serverless puppet with capistrano
68
+ test_files: []
69
+