capistrano-puppet 0.0.1

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.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in capistrano-puppet.gemspec
4
+ gemspec
data/README ADDED
@@ -0,0 +1,33 @@
1
+ If you're using Puppet you already have a list of the hosts and types of hosts under your control. So why duplication this information in your capistrano configuration?
2
+ Every time you provision or destroy a new machine you have to remember to update your deployment configuration and that's just an error waiting to happen.
3
+
4
+ This requires you to be running my web-puppet service to get at the relevant host and tag information. https://github.com/garethr/web-puppet
5
+
6
+ A sample capistrano configuration might look like the following. The only important parts are the require, creating a new server instance and the calls to get_servers to return a list of hosts.
7
+
8
+ require 'capistrano-puppet'
9
+
10
+ web_puppet = CapistranoPuppet::Server.new('http://localhost:9295')
11
+
12
+ set :application, "test"
13
+ set :repository, "."
14
+ set :scm, :none
15
+ set :deploy_via, :copy
16
+
17
+ default_run_options[:pty] = true
18
+ set :deploy_to, '/server/path/'
19
+ set :user, 'deploy'
20
+ set :use_sudo, false
21
+
22
+ role :web do
23
+ web_puppet.get_servers('webserver')
24
+ end
25
+
26
+ role :web do
27
+ web_puppet.get_servers('appserver')
28
+ end
29
+
30
+
31
+ Note that this is the first release as is really just a proof of concept. Running web-puppet in environments with lots of hosts will likely be very slow. And currently if you're using the HTTP auth built into web-puppet this client can't yet authenticate.
32
+
33
+ The code was inspired by Capistrano-cobbler, which uses Cobbler rather than web-puppet to get the host information. https://github.com/proffalken/capistrano-cobbler
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "capistrano-puppet/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "capistrano-puppet"
7
+ s.version = CapistranoPuppet::VERSION
8
+ s.authors = ["Gareth Rushgrove"]
9
+ s.email = ["gareth@morethanseven.net"]
10
+ s.homepage = ""
11
+ s.summary = %q{"Use puppet to provide hosts for capistrano"}
12
+ s.description = %q{"Connects to the web-puppet webservice and allows puppet hosts and classes to be used to determine hosts for capistrano"}
13
+
14
+ s.rubyforge_project = "capistrano-puppet"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_runtime_dependency "capistrano"
22
+ end
@@ -0,0 +1,3 @@
1
+ module CapistranoPuppet
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,26 @@
1
+ require "capistrano-puppet/version"
2
+ require 'open-uri'
3
+ require 'json'
4
+
5
+ module CapistranoPuppet
6
+
7
+ class Server
8
+ attr_reader :server_list
9
+ attr_reader :puppet_web
10
+
11
+ def initialize(puppet_web)
12
+ @puppet_web = puppet_web
13
+ contents = URI.parse(@puppet_web).read
14
+ @json = JSON.parse(contents)
15
+ end
16
+
17
+ def get_servers(tag)
18
+ server_list = []
19
+ @json.each do |host, details|
20
+ server_list << host if details['tags'].include? tag
21
+ end
22
+ server_list
23
+ end
24
+ end
25
+
26
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-puppet
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Gareth Rushgrove
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-11-05 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: capistrano
16
+ requirement: &70313740345240 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70313740345240
25
+ description: ! '"Connects to the web-puppet webservice and allows puppet hosts and
26
+ classes to be used to determine hosts for capistrano"'
27
+ email:
28
+ - gareth@morethanseven.net
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - .gitignore
34
+ - Gemfile
35
+ - README
36
+ - Rakefile
37
+ - capistrano-puppet.gemspec
38
+ - lib/capistrano-puppet.rb
39
+ - lib/capistrano-puppet/version.rb
40
+ homepage: ''
41
+ licenses: []
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project: capistrano-puppet
60
+ rubygems_version: 1.8.6
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: ! '"Use puppet to provide hosts for capistrano"'
64
+ test_files: []