oscar 0.2.0alpha1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/CHANGELOG +12 -0
- data/Gemfile +1 -0
- data/LICENSE +14 -0
- data/README.markdown +97 -0
- data/Vagrantfile +6 -0
- data/bootstrap/base/pre/set_hostname.sh +3 -0
- data/bootstrap/base/provision/install_puppet_enterprise.sh +6 -0
- data/bootstrap/master/post/relocate_puppet.sh +23 -0
- data/config/.gitignore +1 -0
- data/config/roles.yaml.dist +17 -0
- data/doc/answers/README.markdown +1 -0
- data/doc/answers/agent.txt +10 -0
- data/doc/answers/master-1.1.txt +22 -0
- data/doc/answers/master-2.0.0.txt +42 -0
- data/doc/answers/master-2.5.0.txt +36 -0
- data/doc/answers/master-db.txt +52 -0
- data/lib/oscar.rb +17 -0
- data/lib/oscar/config.rb +97 -0
- data/lib/oscar/environment.rb +28 -0
- data/lib/oscar/networking.rb +47 -0
- data/lib/oscar/node.rb +91 -0
- data/lib/oscar/schema.yaml +73 -0
- data/lib/oscar/version.rb +3 -0
- data/lib/pe_build.rb +13 -0
- data/lib/pe_build/action.rb +20 -0
- data/lib/pe_build/action/download.rb +56 -0
- data/lib/pe_build/action/unpackage.rb +70 -0
- data/lib/pe_build/command.rb +31 -0
- data/lib/pe_build/command/download.rb +8 -0
- data/lib/pe_build/command/list.rb +10 -0
- data/lib/pe_build/config.rb +30 -0
- data/lib/pe_build/provisioners.rb +9 -0
- data/lib/pe_build/provisioners/puppet_enterprise.rb +1 -0
- data/lib/pe_build/provisioners/puppet_enterprise_bootstrap.rb +138 -0
- data/lib/pe_build/version.rb +5 -0
- data/manifests/.gitignore +3 -0
- data/modules/.gitignore +2 -0
- data/oscar.gemspec +27 -0
- data/templates/answers/agent.txt.erb +10 -0
- data/templates/answers/master.txt.erb +52 -0
- metadata +175 -0
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'vagrant'
|
2
|
+
class PEBuild::Command::List < Vagrant::Command::Base
|
3
|
+
def execute
|
4
|
+
if File.directory? PEBuild.archive_directory and (entries = Dir["#{PEBuild.archive_directory}/*"])
|
5
|
+
puts entries.join('\n')
|
6
|
+
else
|
7
|
+
warn "No PE versions downloaded."
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'vagrant'
|
2
|
+
require 'uri'
|
3
|
+
require 'pe_build'
|
4
|
+
|
5
|
+
class PEBuild::Config < Vagrant::Config::Base
|
6
|
+
attr_writer :download_root
|
7
|
+
attr_writer :version
|
8
|
+
attr_writer :filename
|
9
|
+
|
10
|
+
def download_root
|
11
|
+
@download_root || 'https://pm.puppetlabs.com/puppet-enterprise'
|
12
|
+
end
|
13
|
+
|
14
|
+
def version
|
15
|
+
@version || '2.5.3'
|
16
|
+
end
|
17
|
+
|
18
|
+
def filename
|
19
|
+
@filename || "puppet-enterprise-#{version}-all.tar.gz"
|
20
|
+
end
|
21
|
+
|
22
|
+
def validate(env, errors)
|
23
|
+
URI.parse(download_root)
|
24
|
+
rescue
|
25
|
+
# TODO I18n
|
26
|
+
errors.add("Invalid download root '#{download_root.inspect}'")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
Vagrant.config_keys.register(:pe_build) { PEBuild::Config }
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'pe_build'
|
2
|
+
require 'vagrant'
|
3
|
+
|
4
|
+
module PEBuild::Provisioners; end
|
5
|
+
|
6
|
+
require 'pe_build/provisioners/puppet_enterprise_bootstrap'
|
7
|
+
#require 'pe_build/provisioners/puppet_enterprise'
|
8
|
+
|
9
|
+
Vagrant.provisioners.register(:puppet_enterprise_bootstrap) { PEBuild::Provisioners::PuppetEnterpriseBootstrap}
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'pe_build/provisioners'
|
@@ -0,0 +1,138 @@
|
|
1
|
+
require 'pe_build/provisioners'
|
2
|
+
require 'vagrant'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'erb'
|
5
|
+
|
6
|
+
class PEBuild::Provisioners::PuppetEnterpriseBootstrap < Vagrant::Provisioners::Base
|
7
|
+
|
8
|
+
class Config < Vagrant::Config::Base
|
9
|
+
attr_writer :verbose, :master
|
10
|
+
|
11
|
+
def role=(rolename)
|
12
|
+
@role = (rolename.is_a?(Symbol)) ? rolename : rolename.intern
|
13
|
+
end
|
14
|
+
|
15
|
+
def role
|
16
|
+
@role || :agent
|
17
|
+
end
|
18
|
+
|
19
|
+
def verbose
|
20
|
+
@verbose || true
|
21
|
+
end
|
22
|
+
|
23
|
+
def master
|
24
|
+
@master || 'master'
|
25
|
+
end
|
26
|
+
|
27
|
+
def validate(env, errors)
|
28
|
+
errors.add("role must be one of [:master, :agent]") unless [:master, :agent].include? role
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.config_class
|
33
|
+
Config
|
34
|
+
end
|
35
|
+
|
36
|
+
def initialize(*args)
|
37
|
+
super
|
38
|
+
|
39
|
+
load_variables
|
40
|
+
|
41
|
+
@cache_path = File.join(@env[:root_path], '.pe_build')
|
42
|
+
@answers_dir = File.join(@cache_path, 'answers')
|
43
|
+
end
|
44
|
+
|
45
|
+
def validate(app, env)
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
def prepare
|
50
|
+
FileUtils.mkdir @cache_path unless File.directory? @cache_path
|
51
|
+
@env[:action_runner].run(:prep_build, :unpack_directory => @cache_path)
|
52
|
+
end
|
53
|
+
|
54
|
+
def provision!
|
55
|
+
# determine if bootstrapping is necessary
|
56
|
+
|
57
|
+
prepare_answers_file
|
58
|
+
configure_installer
|
59
|
+
|
60
|
+
[:pre, :provision, :post].each do |stepname|
|
61
|
+
[:base, config.role].each do |rolename|
|
62
|
+
step rolename, stepname
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
# I HATE THIS.
|
70
|
+
def load_variables
|
71
|
+
if @env[:box_name]
|
72
|
+
@root = @env[:vm].pe_build.download_root
|
73
|
+
@version = @env[:vm].pe_build.version
|
74
|
+
@filename = @env[:vm].pe_build.version
|
75
|
+
end
|
76
|
+
|
77
|
+
@root ||= @env[:global_config].pe_build.download_root
|
78
|
+
@version ||= @env[:global_config].pe_build.version
|
79
|
+
@filename ||= @env[:global_config].pe_build.filename
|
80
|
+
|
81
|
+
@archive_path = File.join(PEBuild.archive_directory, @filename)
|
82
|
+
end
|
83
|
+
|
84
|
+
# @todo use absolute path for locating answers file template
|
85
|
+
def prepare_answers_file
|
86
|
+
FileUtils.mkdir_p @answers_dir unless File.directory? @answers_dir
|
87
|
+
@env[:ui].info "Creating answers file, node:#{@env[:vm].name}, role: #{config.role}"
|
88
|
+
|
89
|
+
template = File.read("#{@env[:root_path]}/templates/answers/#{config.role}.txt.erb")
|
90
|
+
dest = "#{@answers_dir}/#{@env[:vm].name}.txt"
|
91
|
+
|
92
|
+
contents = ERB.new(template).result(binding)
|
93
|
+
|
94
|
+
@env[:ui].info "Writing answers file to #{dest}"
|
95
|
+
File.open(dest, "w") do |file|
|
96
|
+
file.write contents
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def step(role, stepname)
|
101
|
+
script_dir = File.join(@env[:root_path], 'bootstrap', role.to_s, stepname.to_s)
|
102
|
+
script_list = Dir.glob("#{script_dir}/*")
|
103
|
+
|
104
|
+
if script_list.empty?
|
105
|
+
@env[:ui].info "No steps for #{role}/#{stepname}", :color => :cyan
|
106
|
+
end
|
107
|
+
|
108
|
+
script_list.each do |template_path|
|
109
|
+
template = File.read(template_path)
|
110
|
+
contents = ERB.new(template).result(binding)
|
111
|
+
|
112
|
+
on_remote contents
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# Determine the proper invocation of the PE installer
|
117
|
+
#
|
118
|
+
# @todo Don't restrict this to the universal installer
|
119
|
+
def configure_installer
|
120
|
+
vm_base_dir = "/vagrant/.pe_build"
|
121
|
+
installer = "#{vm_base_dir}/puppet-enterprise-#{@version}-all/puppet-enterprise-installer"
|
122
|
+
answers = "#{vm_base_dir}/answers/#{@env[:vm].name}.txt"
|
123
|
+
log_file = "/root/puppet-enterprise-installer-#{Time.now.strftime('%s')}.log"
|
124
|
+
|
125
|
+
@installer_cmd = "#{installer} -a #{answers} -l #{log_file}"
|
126
|
+
end
|
127
|
+
|
128
|
+
def on_remote(cmd)
|
129
|
+
env[:vm].channel.sudo(cmd) do |type, data|
|
130
|
+
# This section is directly ripped off from the shell provider.
|
131
|
+
if type == :stdout and config.verbose
|
132
|
+
@env[:ui].info(data.chomp, :color => :green, :prefix => false)
|
133
|
+
elsif type == :stderr
|
134
|
+
@env[:ui].info(data.chomp, :color => :red, :prefix => false)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
data/modules/.gitignore
ADDED
data/oscar.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
|
2
|
+
require 'oscar/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = 'oscar'
|
6
|
+
gem.version = Oscar::VERSION
|
7
|
+
gem.date = Date.today.to_s
|
8
|
+
|
9
|
+
gem.summary = 'Easy mode Puppet Enterprise provisioning'
|
10
|
+
gem.description = <<-EOD
|
11
|
+
Oscar is a series of extensions to simplify building out a Puppet Enterprise
|
12
|
+
environment. It handles networking configuration and fetching/installing
|
13
|
+
Puppet Enterprise.
|
14
|
+
EOD
|
15
|
+
|
16
|
+
gem.authors = 'Adrien Thebo'
|
17
|
+
gem.email = 'adrien@somethingsinistral.net'
|
18
|
+
gem.homepage = 'https://github.com/adrienthebo/oscar'
|
19
|
+
|
20
|
+
gem.add_dependency 'vagrant', '~> 1.0.0'
|
21
|
+
gem.add_dependency 'vagrant-hosts', '0.0.1rc1'
|
22
|
+
gem.add_dependency 'kwalify', '~> 0.7.0'
|
23
|
+
gem.add_dependency 'ipaddress', '~> 0.8.0'
|
24
|
+
|
25
|
+
gem.files = %x{git ls-files -z}.split("\0")
|
26
|
+
gem.require_path = 'lib'
|
27
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
q_install=y
|
2
|
+
q_puppet_cloud_install=n
|
3
|
+
q_puppet_enterpriseconsole_install=n
|
4
|
+
q_puppet_symlinks_install=y
|
5
|
+
q_puppetagent_certname=<%= @env[:vm].name %>
|
6
|
+
q_puppetagent_install=y
|
7
|
+
q_puppetagent_server=<%= config.master %>
|
8
|
+
q_puppetmaster_install=n
|
9
|
+
q_vendor_packages_install=y
|
10
|
+
q_continue_or_reenter_master_hostname=c
|
@@ -0,0 +1,52 @@
|
|
1
|
+
q_install=y
|
2
|
+
q_puppet_cloud_install=n
|
3
|
+
|
4
|
+
q_puppet_enterpriseconsole_auth_database_name=console_auth
|
5
|
+
q_puppet_enterpriseconsole_auth_database_password=console_auth
|
6
|
+
q_puppet_enterpriseconsole_auth_database_user=console_auth
|
7
|
+
q_puppet_enterpriseconsole_auth_password=console
|
8
|
+
q_puppet_enterpriseconsole_auth_user_email=console@example.com
|
9
|
+
|
10
|
+
# Use existing database
|
11
|
+
q_puppet_enterpriseconsole_database_install=n
|
12
|
+
q_puppet_enterpriseconsole_setup_db=y
|
13
|
+
|
14
|
+
q_puppet_enterpriseconsole_database_name=console
|
15
|
+
q_puppet_enterpriseconsole_database_user=console
|
16
|
+
q_puppet_enterpriseconsole_database_password=console
|
17
|
+
q_puppet_enterpriseconsole_database_remote=n
|
18
|
+
q_puppet_enterpriseconsole_database_root_password=console
|
19
|
+
|
20
|
+
q_puppet_enterpriseconsole_httpd_port=443
|
21
|
+
q_puppet_enterpriseconsole_install=y
|
22
|
+
|
23
|
+
q_puppet_enterpriseconsole_inventory_hostname=master
|
24
|
+
q_puppet_enterpriseconsole_inventory_port=8140
|
25
|
+
|
26
|
+
q_puppet_enterpriseconsole_master_hostname=master
|
27
|
+
|
28
|
+
q_puppet_enterpriseconsole_smtp_host=smtp.google.com
|
29
|
+
q_puppet_enterpriseconsole_smtp_password=
|
30
|
+
q_puppet_enterpriseconsole_smtp_port=25
|
31
|
+
q_puppet_enterpriseconsole_smtp_use_tls=n
|
32
|
+
q_puppet_enterpriseconsole_smtp_user_auth=n
|
33
|
+
q_puppet_enterpriseconsole_smtp_username=
|
34
|
+
|
35
|
+
q_puppet_symlinks_install=y
|
36
|
+
q_puppetagent_certname=<%= @env[:vm].name %>
|
37
|
+
q_puppetagent_install=y
|
38
|
+
q_puppetagent_server=<%= @env[:vm].name %>
|
39
|
+
q_puppetca_install=y
|
40
|
+
q_puppetmaster_certname=master
|
41
|
+
q_puppetmaster_dnsaltnames=master,puppet
|
42
|
+
q_puppetmaster_enterpriseconsole_hostname=localhost
|
43
|
+
q_puppetmaster_enterpriseconsole_port=443
|
44
|
+
q_puppetmaster_forward_facts=n
|
45
|
+
q_puppetmaster_install=y
|
46
|
+
q_vendor_packages_install=y
|
47
|
+
|
48
|
+
# pe 2.0 option
|
49
|
+
q_puppet_enterpriseconsole_auth_user=console
|
50
|
+
|
51
|
+
# pe 2.0 - 2.5 upgrade options
|
52
|
+
q_puppet_enterpriseconsole_setup_auth_db=y
|
metadata
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: oscar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 3134727173
|
5
|
+
prerelease: 5
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
- alpha
|
11
|
+
- 1
|
12
|
+
version: 0.2.0alpha1
|
13
|
+
platform: ruby
|
14
|
+
authors:
|
15
|
+
- Adrien Thebo
|
16
|
+
autorequire:
|
17
|
+
bindir: bin
|
18
|
+
cert_chain: []
|
19
|
+
|
20
|
+
date: 2012-11-05 00:00:00 Z
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: vagrant
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 23
|
31
|
+
segments:
|
32
|
+
- 1
|
33
|
+
- 0
|
34
|
+
- 0
|
35
|
+
version: 1.0.0
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id001
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: vagrant-hosts
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - "="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 1796845819
|
47
|
+
segments:
|
48
|
+
- 0
|
49
|
+
- 0
|
50
|
+
- 1
|
51
|
+
- rc
|
52
|
+
- 1
|
53
|
+
version: 0.0.1rc1
|
54
|
+
type: :runtime
|
55
|
+
version_requirements: *id002
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: kwalify
|
58
|
+
prerelease: false
|
59
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ~>
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
- 7
|
68
|
+
- 0
|
69
|
+
version: 0.7.0
|
70
|
+
type: :runtime
|
71
|
+
version_requirements: *id003
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: ipaddress
|
74
|
+
prerelease: false
|
75
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ~>
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
hash: 63
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
- 8
|
84
|
+
- 0
|
85
|
+
version: 0.8.0
|
86
|
+
type: :runtime
|
87
|
+
version_requirements: *id004
|
88
|
+
description: " Oscar is a series of extensions to simplify building out a Puppet Enterprise\n environment. It handles networking configuration and fetching/installing\n Puppet Enterprise.\n"
|
89
|
+
email: adrien@somethingsinistral.net
|
90
|
+
executables: []
|
91
|
+
|
92
|
+
extensions: []
|
93
|
+
|
94
|
+
extra_rdoc_files: []
|
95
|
+
|
96
|
+
files:
|
97
|
+
- .gitignore
|
98
|
+
- CHANGELOG
|
99
|
+
- Gemfile
|
100
|
+
- LICENSE
|
101
|
+
- README.markdown
|
102
|
+
- Vagrantfile
|
103
|
+
- bootstrap/base/pre/set_hostname.sh
|
104
|
+
- bootstrap/base/provision/install_puppet_enterprise.sh
|
105
|
+
- bootstrap/master/post/relocate_puppet.sh
|
106
|
+
- config/.gitignore
|
107
|
+
- config/roles.yaml.dist
|
108
|
+
- doc/answers/README.markdown
|
109
|
+
- doc/answers/agent.txt
|
110
|
+
- doc/answers/master-1.1.txt
|
111
|
+
- doc/answers/master-2.0.0.txt
|
112
|
+
- doc/answers/master-2.5.0.txt
|
113
|
+
- doc/answers/master-db.txt
|
114
|
+
- lib/oscar.rb
|
115
|
+
- lib/oscar/config.rb
|
116
|
+
- lib/oscar/environment.rb
|
117
|
+
- lib/oscar/networking.rb
|
118
|
+
- lib/oscar/node.rb
|
119
|
+
- lib/oscar/schema.yaml
|
120
|
+
- lib/oscar/version.rb
|
121
|
+
- lib/pe_build.rb
|
122
|
+
- lib/pe_build/action.rb
|
123
|
+
- lib/pe_build/action/download.rb
|
124
|
+
- lib/pe_build/action/unpackage.rb
|
125
|
+
- lib/pe_build/command.rb
|
126
|
+
- lib/pe_build/command/download.rb
|
127
|
+
- lib/pe_build/command/list.rb
|
128
|
+
- lib/pe_build/config.rb
|
129
|
+
- lib/pe_build/provisioners.rb
|
130
|
+
- lib/pe_build/provisioners/puppet_enterprise.rb
|
131
|
+
- lib/pe_build/provisioners/puppet_enterprise_bootstrap.rb
|
132
|
+
- lib/pe_build/version.rb
|
133
|
+
- manifests/.gitignore
|
134
|
+
- modules/.gitignore
|
135
|
+
- oscar.gemspec
|
136
|
+
- templates/answers/agent.txt.erb
|
137
|
+
- templates/answers/master.txt.erb
|
138
|
+
homepage: https://github.com/adrienthebo/oscar
|
139
|
+
licenses: []
|
140
|
+
|
141
|
+
post_install_message:
|
142
|
+
rdoc_options: []
|
143
|
+
|
144
|
+
require_paths:
|
145
|
+
- lib
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
none: false
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
hash: 3
|
152
|
+
segments:
|
153
|
+
- 0
|
154
|
+
version: "0"
|
155
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
+
none: false
|
157
|
+
requirements:
|
158
|
+
- - ">"
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
hash: 25
|
161
|
+
segments:
|
162
|
+
- 1
|
163
|
+
- 3
|
164
|
+
- 1
|
165
|
+
version: 1.3.1
|
166
|
+
requirements: []
|
167
|
+
|
168
|
+
rubyforge_project:
|
169
|
+
rubygems_version: 1.8.24
|
170
|
+
signing_key:
|
171
|
+
specification_version: 3
|
172
|
+
summary: Easy mode Puppet Enterprise provisioning
|
173
|
+
test_files: []
|
174
|
+
|
175
|
+
has_rdoc:
|