gepetto 0.0.8
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/History.txt +4 -0
- data/Manifest.txt +35 -0
- data/README.rdoc +212 -0
- data/Rakefile +28 -0
- data/app_generators/gepetto/USAGE +0 -0
- data/app_generators/gepetto/gepetto_generator.rb +35 -0
- data/app_generators/gepetto/templates/Rakefile +24 -0
- data/app_generators/gepetto/templates/config/fileserver.conf +7 -0
- data/app_generators/gepetto/templates/config/puppet.conf +11 -0
- data/app_generators/gepetto/templates/manifests/classes/empty.pp +1 -0
- data/app_generators/gepetto/templates/manifests/defaults.pp +12 -0
- data/app_generators/gepetto/templates/manifests/nodes.pp +5 -0
- data/app_generators/gepetto/templates/manifests/site.pp +9 -0
- data/app_generators/gepetto/templates/manifests/templates.pp +0 -0
- data/app_generators/gepetto/templates/script/module +67 -0
- data/app_generators/gepetto/templates/script/puppetca +3 -0
- data/app_generators/gepetto/templates/script/puppetmasterd +13 -0
- data/app_generators/gepetto/templates/script/puppetrun +2 -0
- data/bin/gepetto +18 -0
- data/gepetto.gemspec +37 -0
- data/lib/gepetto.rb +6 -0
- data/lib/gepetto/tasks.rb +1 -0
- data/puppet_generators/module/USAGE +18 -0
- data/puppet_generators/module/module_generator.rb +24 -0
- data/puppet_generators/module/templates/README +0 -0
- data/puppet_generators/module/templates/manifests/init.pp +0 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/tasks/host.pp +75 -0
- data/tasks/log.rake +9 -0
- data/tasks/puppet.rake +8 -0
- data/tasks/sandbox.pp +101 -0
- data/tasks/sandbox.rake +437 -0
- data/tasks/tmp.rake +24 -0
- data/tasks/utils.rake +17 -0
- metadata +104 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
README.rdoc
|
4
|
+
Rakefile
|
5
|
+
app_generators/gepetto/USAGE
|
6
|
+
app_generators/gepetto/gepetto_generator.rb
|
7
|
+
app_generators/gepetto/templates/Rakefile
|
8
|
+
app_generators/gepetto/templates/config/fileserver.conf
|
9
|
+
app_generators/gepetto/templates/config/puppet.conf
|
10
|
+
app_generators/gepetto/templates/manifests/classes/empty.pp
|
11
|
+
app_generators/gepetto/templates/manifests/defaults.pp
|
12
|
+
app_generators/gepetto/templates/manifests/nodes.pp
|
13
|
+
app_generators/gepetto/templates/manifests/site.pp
|
14
|
+
app_generators/gepetto/templates/manifests/templates.pp
|
15
|
+
app_generators/gepetto/templates/script/module
|
16
|
+
app_generators/gepetto/templates/script/puppetca
|
17
|
+
app_generators/gepetto/templates/script/puppetmasterd
|
18
|
+
app_generators/gepetto/templates/script/puppetrun
|
19
|
+
bin/gepetto
|
20
|
+
gepetto.gemspec
|
21
|
+
lib/gepetto.rb
|
22
|
+
lib/gepetto/tasks.rb
|
23
|
+
puppet_generators/module/USAGE
|
24
|
+
puppet_generators/module/module_generator.rb
|
25
|
+
puppet_generators/module/templates/README
|
26
|
+
puppet_generators/module/templates/manifests/init.pp
|
27
|
+
script/destroy
|
28
|
+
script/generate
|
29
|
+
tasks/host.pp
|
30
|
+
tasks/log.rake
|
31
|
+
tasks/puppet.rake
|
32
|
+
tasks/sandbox.pp
|
33
|
+
tasks/sandbox.rake
|
34
|
+
tasks/tmp.rake
|
35
|
+
tasks/utils.rake
|
data/README.rdoc
ADDED
@@ -0,0 +1,212 @@
|
|
1
|
+
= Gepetto
|
2
|
+
|
3
|
+
* http://github.com/albanpeignier/gepetto/
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
A helper suite for Puppet projects to create, manage and help daily development
|
8
|
+
|
9
|
+
More information about Puppet: http://reductivelabs.com/trac/puppet/
|
10
|
+
|
11
|
+
== FEATURES:
|
12
|
+
|
13
|
+
Creates base project:
|
14
|
+
|
15
|
+
* create Puppet File Hierarchy
|
16
|
+
* create default manifests files
|
17
|
+
|
18
|
+
Provides helper tools:
|
19
|
+
|
20
|
+
* script/puppetmasterd: to start a local puppetmasterd
|
21
|
+
* script/puppetca: to manage local ssl directory
|
22
|
+
* script/puppetrun: request a puppet run
|
23
|
+
* script/module: to install external module
|
24
|
+
|
25
|
+
* script/generate: generate puppet code (for module, ...)
|
26
|
+
|
27
|
+
Provides rake tasks:
|
28
|
+
|
29
|
+
* sandbox tasks: to create, start and control sandbox for development
|
30
|
+
* puppet tasks: to check syntax
|
31
|
+
* clean temporary or log files
|
32
|
+
|
33
|
+
== SYNOPSIS:
|
34
|
+
|
35
|
+
Create a new puppet project
|
36
|
+
|
37
|
+
gepetto /path/to/new/puppet/project
|
38
|
+
|
39
|
+
create
|
40
|
+
create script
|
41
|
+
create config
|
42
|
+
create manifests
|
43
|
+
create files
|
44
|
+
create templates
|
45
|
+
create tasks
|
46
|
+
create Rakefile
|
47
|
+
create manifests/site.pp
|
48
|
+
create manifests/templates.pp
|
49
|
+
create manifests/nodes.pp
|
50
|
+
create config/puppet.conf
|
51
|
+
create config/fileserver.conf
|
52
|
+
create script/puppetmasterd
|
53
|
+
create script/puppetca
|
54
|
+
create script/puppetrun
|
55
|
+
create script/module
|
56
|
+
dependency install_rubigen_scripts
|
57
|
+
exists script
|
58
|
+
create script/generate
|
59
|
+
create script/destroy
|
60
|
+
|
61
|
+
Start a puppetmasterd with project files:
|
62
|
+
|
63
|
+
./script/puppetmasterd &
|
64
|
+
|
65
|
+
notice: Starting Puppet server version 0.24.5
|
66
|
+
|
67
|
+
Create and start a sandbox:
|
68
|
+
|
69
|
+
rake sandbox:setup sandbox:create sandbox:start
|
70
|
+
|
71
|
+
Follow sandbox console/syslog:
|
72
|
+
|
73
|
+
tail -f log/sandbox.log
|
74
|
+
|
75
|
+
List waiting client certificates:
|
76
|
+
|
77
|
+
./script/puppetca --list
|
78
|
+
sandbox
|
79
|
+
|
80
|
+
Sign the sandbox certificate:
|
81
|
+
|
82
|
+
rake sandbox:puppet:sign
|
83
|
+
|
84
|
+
Request a puppet run in sandbox:
|
85
|
+
|
86
|
+
rake sandbox:puppet:run
|
87
|
+
|
88
|
+
Install an external module:
|
89
|
+
|
90
|
+
./script/module install git://git.black.co.at/module-common
|
91
|
+
|
92
|
+
install module common in modules/common
|
93
|
+
|
94
|
+
Initialized empty Git repository in modules/common/.git/
|
95
|
+
remote: Counting objects: 322, done.
|
96
|
+
remote: Compressing objects: 100% (217/217), done.
|
97
|
+
remote: Total 322 (delta 110), reused 210 (delta 70)
|
98
|
+
Receiving objects: 100% (322/322), 37.75 KiB, done.
|
99
|
+
Resolving deltas: 100% (110/110), done.
|
100
|
+
|
101
|
+
Create a new Puppet module
|
102
|
+
|
103
|
+
./script/generate module private
|
104
|
+
|
105
|
+
create
|
106
|
+
create manifests
|
107
|
+
create files
|
108
|
+
create templates
|
109
|
+
create README
|
110
|
+
create manifests/init.pp
|
111
|
+
|
112
|
+
== SANDBOX
|
113
|
+
|
114
|
+
For the moment, the sandbox tasks use qemu to create and run a virtual machine
|
115
|
+
with a ready puppetd.
|
116
|
+
|
117
|
+
Define a sandbox in your rakefile:
|
118
|
+
|
119
|
+
Sandbox.new do |s|
|
120
|
+
s.bootstraper = DebianBoostraper.new do |d|
|
121
|
+
d.version = 'lenny'
|
122
|
+
d.mirror = 'http://ftp.fr.debian.org/debian'
|
123
|
+
end
|
124
|
+
|
125
|
+
s.disk_size = '1G'
|
126
|
+
s.memory_size = '128M'
|
127
|
+
end
|
128
|
+
|
129
|
+
Setup your host to create and start sandbox:
|
130
|
+
|
131
|
+
rake sandbox:setup
|
132
|
+
|
133
|
+
It installs qemu, kqemu module and uml-utilities
|
134
|
+
|
135
|
+
Create a fresh image for sandbox:
|
136
|
+
|
137
|
+
rake sandbox:create
|
138
|
+
|
139
|
+
By default, it will create a disk of 512M with a debian lenny.
|
140
|
+
|
141
|
+
Start a qemu instance with the sandbox image:
|
142
|
+
|
143
|
+
rake sandbox:start
|
144
|
+
|
145
|
+
Follow the console (and syslog) output of the sandbox:
|
146
|
+
|
147
|
+
tail -f log/sandbox.log
|
148
|
+
|
149
|
+
[...]
|
150
|
+
Starting puppet configuration management tool
|
151
|
+
|
152
|
+
Debian GNU/Linux 5.0 sandbox ttyS0
|
153
|
+
sandbox login:
|
154
|
+
|
155
|
+
Jan 31 14:22:30 sandbox puppetd[1430]: Reopening log files.
|
156
|
+
Jan 31 14:22:32 sandbox puppetd[1430]: Could not request certificate
|
157
|
+
|
158
|
+
|
159
|
+
Sign the new sandbox certificat:
|
160
|
+
|
161
|
+
rake sandbox:puppet:sign
|
162
|
+
|
163
|
+
Request a puppet run in the sandbox:
|
164
|
+
|
165
|
+
rake sandbox:puppet:run
|
166
|
+
|
167
|
+
Stop the sandbox vm:
|
168
|
+
|
169
|
+
rake sandbox:stop
|
170
|
+
|
171
|
+
Destroy sandbox files:
|
172
|
+
|
173
|
+
rake sandbox:destroy
|
174
|
+
|
175
|
+
== REQUIREMENTS:
|
176
|
+
|
177
|
+
* puppet and puppetmaster: http://reductivelabs.com/trac/puppet/
|
178
|
+
* rubigen: http://rubigen.rubyforge.org/
|
179
|
+
|
180
|
+
== INSTALL:
|
181
|
+
|
182
|
+
sudo gem install gepetto
|
183
|
+
|
184
|
+
or to use the development release:
|
185
|
+
|
186
|
+
gem sources -a http://gems.github.com
|
187
|
+
sudo gem install albanpeignier-gepetto
|
188
|
+
|
189
|
+
== LICENSE:
|
190
|
+
|
191
|
+
(The MIT License)
|
192
|
+
|
193
|
+
Copyright (c) 2009 Alban Peignier
|
194
|
+
|
195
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
196
|
+
a copy of this software and associated documentation files (the
|
197
|
+
'Software'), to deal in the Software without restriction, including
|
198
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
199
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
200
|
+
permit persons to whom the Software is furnished to do so, subject to
|
201
|
+
the following conditions:
|
202
|
+
|
203
|
+
The above copyright notice and this permission notice shall be
|
204
|
+
included in all copies or substantial portions of the Software.
|
205
|
+
|
206
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
207
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
208
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
209
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
210
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
211
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
212
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'hoe', '>= 2.1.0'
|
3
|
+
require 'hoe'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
require File.dirname(__FILE__) + '/lib/gepetto'
|
7
|
+
|
8
|
+
Hoe.plugin :newgem
|
9
|
+
|
10
|
+
# Generate all the Rake tasks
|
11
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
12
|
+
$hoe = Hoe.spec 'gepetto' do
|
13
|
+
self.version = Gepetto::VERSION
|
14
|
+
self.developer('Alban Peignier', 'alban.peignier@free.fr')
|
15
|
+
self.changes = self.paragraphs_of("History.txt", 0..1).join("\n\n")
|
16
|
+
self.rubyforge_name = self.name # TODO this is default value
|
17
|
+
|
18
|
+
self.clean_globs |= %w[**/.DS_Store tmp *.log]
|
19
|
+
path = (self.rubyforge_name == self.name) ? self.rubyforge_name : "\#{self.rubyforge_name}/\#{self.name}"
|
20
|
+
self.remote_rdoc_dir = File.join(path.gsub(/^#{self.rubyforge_name}\/?/,''), 'rdoc')
|
21
|
+
self.rsync_args = '-av --delete --ignore-errors'
|
22
|
+
end
|
23
|
+
|
24
|
+
require 'newgem/tasks' # load /tasks/*.rake
|
25
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
26
|
+
|
27
|
+
# TODO - want other tests/tasks run by default? Add them to the list
|
28
|
+
# task :default => [:spec, :features]
|
File without changes
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
|
3
|
+
class GepettoGenerator < RubiGen::Base
|
4
|
+
|
5
|
+
def initialize(runtime_args, runtime_options = {})
|
6
|
+
super
|
7
|
+
|
8
|
+
usage if args.empty?
|
9
|
+
@destination_root = File.expand_path(args.shift)
|
10
|
+
end
|
11
|
+
|
12
|
+
def manifest
|
13
|
+
script_options = { :chmod => 0755 }
|
14
|
+
|
15
|
+
record do |m|
|
16
|
+
# Root directory and all subdirectories.
|
17
|
+
m.directory ''
|
18
|
+
|
19
|
+
%w{script config manifests manifests/classes files templates log tasks}.each { |path| m.directory path }
|
20
|
+
|
21
|
+
m.template_copy_each %w( Rakefile )
|
22
|
+
|
23
|
+
m.template_copy_each %w( defaults.pp site.pp templates.pp nodes.pp ), 'manifests'
|
24
|
+
|
25
|
+
m.template_copy_each %w( empty.pp ), 'manifests/classes'
|
26
|
+
|
27
|
+
m.template_copy_each %w( puppet.conf fileserver.conf ), 'config'
|
28
|
+
|
29
|
+
m.template_copy_each %w( puppetmasterd puppetca puppetrun module ), 'script', script_options
|
30
|
+
|
31
|
+
m.dependency "install_rubigen_scripts", [destination_root, "puppet"]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
%w[rubygems rake rake/clean fileutils].each { |f| require f }
|
2
|
+
|
3
|
+
require 'gepetto/tasks' # load /tasks/*.rake
|
4
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
5
|
+
|
6
|
+
# Change the sandbox storage directory
|
7
|
+
# Sandbox.images_directory = '/disks/sandbox'
|
8
|
+
|
9
|
+
Sandbox.new do |s|
|
10
|
+
s.bootstraper = DebianBoostraper.new do |d|
|
11
|
+
# Specify the wanted debian distribution
|
12
|
+
# d.version = 'lenny'
|
13
|
+
|
14
|
+
# Use a local debian mirror
|
15
|
+
# d.mirror = 'http://ftp.fr.debian.org/debian'
|
16
|
+
|
17
|
+
# Use a local apt-proxy
|
18
|
+
# d.mirror = 'http://127.0.0.1:9999/debian'
|
19
|
+
end
|
20
|
+
|
21
|
+
# s.disk_size = '1G'
|
22
|
+
# s.memory_size = '128M'
|
23
|
+
end
|
24
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
# Remove me when your first classes are defined
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Some useful defaults
|
2
|
+
|
3
|
+
Exec { path => "/usr/bin:/usr/sbin/:/bin:/sbin:/usr/local/bin:/usr/local/sbin" }
|
4
|
+
|
5
|
+
File {
|
6
|
+
ignore => ['.svn', '.git', 'CVS' ],
|
7
|
+
checksum => md5,
|
8
|
+
owner => root, group => root,
|
9
|
+
backup => server
|
10
|
+
}
|
11
|
+
|
12
|
+
filebucket { server: server => puppet }
|
File without changes
|
@@ -0,0 +1,67 @@
|
|
1
|
+
#!/bin/bash -e
|
2
|
+
|
3
|
+
# TODO just a POC, make a real implementation
|
4
|
+
|
5
|
+
function usage() {
|
6
|
+
cat - <<EOF
|
7
|
+
Usage: module [OPTIONS] command
|
8
|
+
Puppet module manager.
|
9
|
+
GENERAL OPTIONS
|
10
|
+
-h, --help Show this help message.
|
11
|
+
COMMANDS
|
12
|
+
install Install module from an URL.
|
13
|
+
EXAMPLES
|
14
|
+
Install a module from a git URL:
|
15
|
+
module install git://github.com/lak/puppet-puppet.git
|
16
|
+
Install a module from a git URL and a specified name:
|
17
|
+
module install git://github.com/lak/puppet-puppet.git lak-puppet
|
18
|
+
EOF
|
19
|
+
exit 0
|
20
|
+
}
|
21
|
+
|
22
|
+
command=$1
|
23
|
+
[ -z "$command" ] && usage
|
24
|
+
|
25
|
+
shift
|
26
|
+
|
27
|
+
modules_dir=modules
|
28
|
+
[ -d $modules_dir ] || mkdir $modules_dir
|
29
|
+
cd $modules_dir
|
30
|
+
|
31
|
+
case $command in
|
32
|
+
install)
|
33
|
+
if [ ! -x "/usr/bin/git" ]; then
|
34
|
+
echo "You must install git to retrieve modules managed with it (apt-get install git-core)"
|
35
|
+
exit 1
|
36
|
+
fi
|
37
|
+
|
38
|
+
module_url=$1
|
39
|
+
[ -z "$module_url" ] && usage
|
40
|
+
|
41
|
+
shift
|
42
|
+
|
43
|
+
if [ $# -gt 0 ]; then
|
44
|
+
module_name=$1
|
45
|
+
shift
|
46
|
+
else
|
47
|
+
module_name=`echo $module_url | sed 's@.*/\(.*\)$@\1@'`
|
48
|
+
# remove .git suffix
|
49
|
+
module_name=`echo $module_name | sed 's/\.git$//'`
|
50
|
+
# remove puppet- or module- prefix
|
51
|
+
module_name=`echo $module_name | sed -e 's/^puppet-//' -e 's/^module-//'`
|
52
|
+
fi
|
53
|
+
|
54
|
+
if [ -d $module_name ]; then
|
55
|
+
echo "module $module_name already installed"
|
56
|
+
exit 1
|
57
|
+
fi
|
58
|
+
|
59
|
+
echo "install module $module_name in $modules_dir/$module_name"
|
60
|
+
|
61
|
+
git clone $module_url $module_name
|
62
|
+
rm -rf $module_name/.git
|
63
|
+
;;
|
64
|
+
*)
|
65
|
+
usage
|
66
|
+
;;
|
67
|
+
esac
|