sooty-puppet 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +53 -0
- data/Rakefile +2 -0
- data/lib/sooty.rb +72 -0
- data/lib/sooty/version.rb +3 -0
- data/sooty.gemspec +19 -0
- metadata +90 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 David Winter
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Sooty
|
2
|
+
|
3
|
+
Install Puppet via Rake and apply your manifests.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'sooty'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install sooty
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Sooty allows you to easily setup Puppet on your server, and apply your manifests
|
22
|
+
to it.
|
23
|
+
|
24
|
+
A simple example for your `Rakefile` would be:
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
require 'sooty'
|
30
|
+
|
31
|
+
set :domain, 'user@server.com'
|
32
|
+
|
33
|
+
set :puppet_manifest, 'private/puppet/manifest.pp'
|
34
|
+
set :puppet_modules, 'private/puppet/modules'
|
35
|
+
|
36
|
+
You'd then the following once to get Puppet installed:
|
37
|
+
|
38
|
+
rake sooty:setup
|
39
|
+
|
40
|
+
Then whenever you make changes to your Puppet manifests, just run:
|
41
|
+
|
42
|
+
rake sooty:apply
|
43
|
+
|
44
|
+
This will apply those changes on the server for you and ensure everything is
|
45
|
+
up-to-date.
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
1. Fork it
|
50
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
51
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
52
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
53
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/sooty.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'rake/remote_task'
|
2
|
+
|
3
|
+
namespace :sooty do
|
4
|
+
|
5
|
+
remote_task :setup do
|
6
|
+
run setup_puppet_repo_cmd
|
7
|
+
run install_puppet_cmd
|
8
|
+
end
|
9
|
+
|
10
|
+
remote_task :apply do
|
11
|
+
sh create_puppet_archive_cmd
|
12
|
+
rsync '/tmp/puppet.tar.gz', '/tmp'
|
13
|
+
run puppet_apply_cmd
|
14
|
+
end
|
15
|
+
|
16
|
+
def setup_puppet_repo_cmd
|
17
|
+
deb_file = 'puppetlabs-release_1.0-3_all.deb'
|
18
|
+
|
19
|
+
repo_cmd = [
|
20
|
+
"wget http://apt.puppetlabs.com/#{deb_file}",
|
21
|
+
"sudo dpkg -i #{deb_file}",
|
22
|
+
"rm #{deb_file}"
|
23
|
+
].join(' && ')
|
24
|
+
|
25
|
+
"test -f /etc/apt/sources.list.d/puppetlabs.list || { #{repo_cmd}; }"
|
26
|
+
end
|
27
|
+
|
28
|
+
def install_puppet_cmd
|
29
|
+
install_cmd = [
|
30
|
+
'sudo apt-get update',
|
31
|
+
'sudo aptitude install -y puppet'
|
32
|
+
].join(' && ')
|
33
|
+
|
34
|
+
"which puppet || { #{install_cmd}; }"
|
35
|
+
end
|
36
|
+
|
37
|
+
def create_puppet_archive_cmd
|
38
|
+
cmds = [
|
39
|
+
'rm -rf /tmp/puppet',
|
40
|
+
'mkdir /tmp/puppet',
|
41
|
+
"cp #{puppet_manifest} /tmp/puppet/manifest.pp"
|
42
|
+
]
|
43
|
+
|
44
|
+
if defined? puppet_modules
|
45
|
+
cmds += ["cp -r #{puppet_modules} /tmp/puppet/modules"]
|
46
|
+
end
|
47
|
+
|
48
|
+
cmds += [
|
49
|
+
'cd /tmp',
|
50
|
+
'tar cvfz puppet.tar.gz puppet'
|
51
|
+
]
|
52
|
+
|
53
|
+
cmds.join(' && ')
|
54
|
+
end
|
55
|
+
|
56
|
+
def puppet_apply_cmd
|
57
|
+
cmds = [
|
58
|
+
'cd /tmp',
|
59
|
+
'tar xvfz puppet.tar.gz',
|
60
|
+
'cd puppet'
|
61
|
+
]
|
62
|
+
|
63
|
+
puppet_cmd = 'sudo puppet apply '
|
64
|
+
puppet_cmd += '--modulepath=/tmp/puppet/modules ' if defined? puppet_modules
|
65
|
+
puppet_cmd += 'manifest.pp'
|
66
|
+
|
67
|
+
cmds += [puppet_cmd]
|
68
|
+
|
69
|
+
cmds.join(' && ')
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
data/sooty.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/sooty/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["David Winter"]
|
6
|
+
gem.email = ["i@djw.me"]
|
7
|
+
gem.description = %q{Install Puppet via Rake and apply your manifests.}
|
8
|
+
gem.summary = gem.description
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "sooty-puppet"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Sooty::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency "rake-remote_task", "~> 2.0.6"
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sooty-puppet
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- David Winter
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-05-13 00:00:00 +01:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rake-remote_task
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 0
|
33
|
+
- 6
|
34
|
+
version: 2.0.6
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
description: Install Puppet via Rake and apply your manifests.
|
38
|
+
email:
|
39
|
+
- i@djw.me
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files: []
|
45
|
+
|
46
|
+
files:
|
47
|
+
- .gitignore
|
48
|
+
- Gemfile
|
49
|
+
- LICENSE
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- lib/sooty.rb
|
53
|
+
- lib/sooty/version.rb
|
54
|
+
- sooty.gemspec
|
55
|
+
has_rdoc: true
|
56
|
+
homepage: ""
|
57
|
+
licenses: []
|
58
|
+
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
hash: 3
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
version: "0"
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
hash: 3
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
version: "0"
|
82
|
+
requirements: []
|
83
|
+
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 1.6.2
|
86
|
+
signing_key:
|
87
|
+
specification_version: 3
|
88
|
+
summary: Install Puppet via Rake and apply your manifests.
|
89
|
+
test_files: []
|
90
|
+
|