vagrant-pe_build 0.0.2 → 0.0.3

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/README.markdown CHANGED
@@ -45,8 +45,8 @@ configure VMs with semi-sane DNS.
45
45
  Contact
46
46
  -------
47
47
 
48
- * Source code: https://github.com/adrienthebo/puppet-network
49
- * Issue tracker: https://github.com/adrienthebo/puppet-network/issues
48
+ * Source code: https://github.com/adrienthebo/vagrant-pe\_build
49
+ * Issue tracker: https://github.com/adrienthebo/vagrant-pe\_build/issues
50
50
 
51
51
  If you have questions or concerns about this module, contact finch on #vagrant
52
52
  on Freenode, or email adrien@puppetlabs.com.
data/lib/pe_build.rb CHANGED
@@ -6,7 +6,7 @@ module PEBuild
6
6
  end
7
7
 
8
8
  def self.source_root
9
- @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), '..'))
9
+ @source_root ||= File.expand_path('..', File.dirname(__FILE__))
10
10
  end
11
11
  end
12
12
 
@@ -28,7 +28,7 @@ class PEBuild::Action::Download
28
28
  if @env[:box_name]
29
29
  @root = @env[:vm].pe_build.download_root
30
30
  @version = @env[:vm].pe_build.version
31
- @filename = @env[:vm].pe_build.version
31
+ @filename = @env[:vm].pe_build.filename
32
32
  end
33
33
 
34
34
  @root ||= @env[:global_config].pe_build.download_root
@@ -2,7 +2,7 @@ require 'vagrant'
2
2
  class PEBuild::Command::List < Vagrant::Command::Base
3
3
  def execute
4
4
  if File.directory? PEBuild.archive_directory and (entries = Dir["#{PEBuild.archive_directory}/*"])
5
- puts entries.join('\n')
5
+ puts entries.join("\n")
6
6
  else
7
7
  warn "No PE versions downloaded."
8
8
  end
@@ -6,6 +6,7 @@ class PEBuild::Config < Vagrant::Config::Base
6
6
  attr_writer :download_root
7
7
  attr_writer :version
8
8
  attr_writer :filename
9
+ attr_writer :suffix
9
10
 
10
11
  def download_root
11
12
  @download_root
@@ -19,6 +20,10 @@ class PEBuild::Config < Vagrant::Config::Base
19
20
  @filename
20
21
  end
21
22
 
23
+ def suffix
24
+ @suffix || :all
25
+ end
26
+
22
27
  def validate(env, errors)
23
28
  URI.parse(download_root)
24
29
  rescue
@@ -7,7 +7,7 @@ require 'erb'
7
7
  class PEBuild::Provisioners::PuppetEnterpriseBootstrap < Vagrant::Provisioners::Base
8
8
 
9
9
  class Config < Vagrant::Config::Base
10
- attr_writer :verbose, :master
10
+ attr_writer :verbose, :master, :answers
11
11
 
12
12
  def role=(rolename)
13
13
  @role = (rolename.is_a?(Symbol)) ? rolename : rolename.intern
@@ -25,8 +25,27 @@ class PEBuild::Provisioners::PuppetEnterpriseBootstrap < Vagrant::Provisioners::
25
25
  @master || 'master'
26
26
  end
27
27
 
28
+ def answers
29
+ # Either the path the user provided to the answers file under
30
+ # the project answers dir, or see if one exists based on the role.
31
+ @answers || "#{role}.txt"
32
+ end
33
+
34
+ def step
35
+ @step || @step = {}
36
+ end
37
+
38
+ def add_step(name, script_path)
39
+ name = (name.is_a?(Symbol)) ? name : name.intern
40
+ step[name] = script_path
41
+ end
42
+
28
43
  def validate(env, errors)
29
44
  errors.add("role must be one of [:master, :agent]") unless [:master, :agent].include? role
45
+
46
+ step.keys.each do |key|
47
+ errors.add("step name :#{key.to_s} is invalid, must be one of [:pre, :provision, :post]") unless [:pre, :provision, :post].include? key
48
+ end
30
49
  end
31
50
  end
32
51
 
@@ -60,7 +79,7 @@ class PEBuild::Provisioners::PuppetEnterpriseBootstrap < Vagrant::Provisioners::
60
79
 
61
80
  [:pre, :provision, :post].each do |stepname|
62
81
  [:base, config.role].each do |rolename|
63
- step rolename, stepname
82
+ process_step rolename, stepname
64
83
  end
65
84
  end
66
85
  end
@@ -73,19 +92,28 @@ class PEBuild::Provisioners::PuppetEnterpriseBootstrap < Vagrant::Provisioners::
73
92
  @root = @env[:vm].pe_build.download_root
74
93
  @version = @env[:vm].pe_build.version
75
94
  @filename = @env[:vm].pe_build.version
95
+ @suffix = @env[:vm].pe_build.suffix
76
96
  end
77
97
 
78
98
  @root ||= @env[:global_config].pe_build.download_root
79
99
  @version ||= @env[:global_config].pe_build.version
80
100
  @filename ||= @env[:global_config].pe_build.filename
101
+ @suffix ||= @env[:global_config].pe_build.suffix
81
102
  end
82
103
 
83
104
  def prepare_answers_file
84
- FileUtils.mkdir_p @answers_dir unless File.directory? @answers_dir
85
105
  @env[:ui].info "Creating answers file, node:#{@env[:vm].name}, role: #{config.role}"
86
-
87
- template = File.read("#{PEBuild.source_root}/templates/answers/#{config.role}.txt.erb")
88
- dest = "#{@answers_dir}/#{@env[:vm].name}.txt"
106
+ FileUtils.mkdir_p @answers_dir unless File.directory? @answers_dir
107
+ dest = "#{@answers_dir}/#{@env[:vm].name}.txt"
108
+
109
+ # answers dir is enforced
110
+ user_answers = File.join(@env[:root_path],"answers/#{config.answers}")
111
+ if File.exists?(user_answers)
112
+ template = File.read(user_answers)
113
+ else
114
+ @env[:ui].info "Using default answers, no answers file available at #{user_answers}"
115
+ template = File.read("#{PEBuild.source_root}/templates/answers/#{config.role}.txt.erb")
116
+ end
89
117
 
90
118
  contents = ERB.new(template).result(binding)
91
119
 
@@ -95,15 +123,28 @@ class PEBuild::Provisioners::PuppetEnterpriseBootstrap < Vagrant::Provisioners::
95
123
  end
96
124
  end
97
125
 
98
- def step(role, stepname)
99
- script_dir = File.join(PEBuild.source_root, 'bootstrap', role.to_s, stepname.to_s)
100
- script_list = Dir.glob("#{script_dir}/*")
126
+ def process_step(role, stepname)
127
+
128
+ if role != :base && config.step[stepname]
129
+ if File.file? config.step[stepname]
130
+ script_list = [*config.step[stepname]]
131
+ else
132
+ script_list = []
133
+ @env[:ui].warn "Cannot find defined step for #{role}/#{stepname.to_s} at \'#{config.step[stepname]}\'"
134
+ end
135
+ else
136
+ # We do not have a user defined step for this role or we're processing the :base step
137
+ script_dir = File.join(PEBuild.source_root, 'bootstrap', role.to_s, stepname.to_s)
138
+ script_list = Dir.glob("#{script_dir}/*")
139
+ end
101
140
 
102
141
  if script_list.empty?
103
142
  @env[:ui].info "No steps for #{role}/#{stepname}", :color => :cyan
104
143
  end
105
144
 
106
145
  script_list.each do |template_path|
146
+ # A message to show which step's action is running
147
+ @env[:ui].info "Running action for #{role}/#{stepname}"
107
148
  template = File.read(template_path)
108
149
  contents = ERB.new(template).result(binding)
109
150
 
@@ -112,11 +153,9 @@ class PEBuild::Provisioners::PuppetEnterpriseBootstrap < Vagrant::Provisioners::
112
153
  end
113
154
 
114
155
  # Determine the proper invocation of the PE installer
115
- #
116
- # @todo Don't restrict this to the universal installer
117
156
  def configure_installer
118
157
  vm_base_dir = "/vagrant/.pe_build"
119
- installer = "#{vm_base_dir}/puppet-enterprise-#{@version}-all/puppet-enterprise-installer"
158
+ installer = "#{vm_base_dir}/puppet-enterprise-#{@version}-#{@suffix}/puppet-enterprise-installer"
120
159
  answers = "#{vm_base_dir}/answers/#{@env[:vm].name}.txt"
121
160
  log_file = "/root/puppet-enterprise-installer-#{Time.now.strftime('%s')}.log"
122
161
 
@@ -1,3 +1,3 @@
1
1
  module PEBuild
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -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
@@ -1,38 +1,32 @@
1
1
  q_install=y
2
2
  q_puppet_cloud_install=n
3
+ q_puppet_enterpriseconsole_setup_db=n
4
+ q_puppet_symlinks_install=y
3
5
 
4
6
  q_puppet_enterpriseconsole_auth_database_name=console_auth
5
7
  q_puppet_enterpriseconsole_auth_database_password=console_auth
6
8
  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
9
+ q_puppet_enterpriseconsole_auth_password=pe-console
10
+ q_puppet_enterpriseconsole_auth_user_email=admin@puppetlabs.com
13
11
 
12
+ q_puppet_enterpriseconsole_database_install=y
14
13
  q_puppet_enterpriseconsole_database_name=console
15
14
  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
15
+ q_puppet_enterpriseconsole_database_password=tGNHTQAUl9mEkA8K5447
16
+ q_puppet_enterpriseconsole_database_root_password=UHJn4CrTp5UgLnPJbDB5
19
17
 
20
- q_puppet_enterpriseconsole_httpd_port=443
18
+ q_puppet_enterpriseconsole_httpd_port=20443
21
19
  q_puppet_enterpriseconsole_install=y
22
-
23
20
  q_puppet_enterpriseconsole_inventory_hostname=master
24
21
  q_puppet_enterpriseconsole_inventory_port=8140
25
-
26
22
  q_puppet_enterpriseconsole_master_hostname=master
27
-
28
- q_puppet_enterpriseconsole_smtp_host=smtp.google.com
23
+ q_puppet_enterpriseconsole_smtp_host=localhost
29
24
  q_puppet_enterpriseconsole_smtp_password=
30
25
  q_puppet_enterpriseconsole_smtp_port=25
31
26
  q_puppet_enterpriseconsole_smtp_use_tls=n
32
27
  q_puppet_enterpriseconsole_smtp_user_auth=n
33
28
  q_puppet_enterpriseconsole_smtp_username=
34
29
 
35
- q_puppet_symlinks_install=y
36
30
  q_puppetagent_certname=<%= @env[:vm].name %>
37
31
  q_puppetagent_install=y
38
32
  q_puppetagent_server=<%= @env[:vm].name %>
@@ -40,13 +34,7 @@ q_puppetca_install=y
40
34
  q_puppetmaster_certname=master
41
35
  q_puppetmaster_dnsaltnames=master,puppet
42
36
  q_puppetmaster_enterpriseconsole_hostname=localhost
43
- q_puppetmaster_enterpriseconsole_port=443
44
- q_puppetmaster_forward_facts=n
37
+ q_puppetmaster_enterpriseconsole_port=20443
45
38
  q_puppetmaster_install=y
46
39
  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
40
+ q_verify_packages=y
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-pe_build
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-21 00:00:00.000000000 Z
12
+ date: 2013-03-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: vagrant
@@ -58,6 +58,7 @@ files:
58
58
  - lib/pe_build/version.rb
59
59
  - lib/vagrant_init.rb
60
60
  - templates/answers/agent.txt.erb
61
+ - templates/answers/master-existing-db.txt.erb
61
62
  - templates/answers/master.txt.erb
62
63
  - vagrant-pe_build.gemspec
63
64
  homepage: https://github.com/adrienthebo/vagrant-pe_build