Permalink
Browse files

(maint) Fix harness PE installer for master/agents

Harnsess was not correctly handling cases where
Masters also installed the Puppet Agent.
  • Loading branch information...
1 parent 8b63db7 commit fe7cc3d947e352f7db5cc626aa28862388d5d43f Dominic Maraglia committed Aug 5, 2011
Showing with 19 additions and 67 deletions.
  1. +16 −57 setup/early/02-gen-answer-file.rb
  2. +3 −10 setup/pe/01_PE-InstallPuppet.rb
@@ -29,30 +29,6 @@
q_vendor_packages_install=y
]
-
-# Master and Dashboard answers
-master_dashboard_a = %q[
-q_vendor_packages_install=y
-q_install=y
-q_puppet_symlinks_install=y
-q_puppetagent_install=n
-q_puppetmaster_certdnsnames=puppet:`uname | grep -i sunos > /dev/null && hostname || hostname -s`
-q_puppetmaster_certname=`uname | grep -i sunos > /dev/null && hostname || hostname -s`
-q_puppetmaster_dashboard_hostname=DASHBOARDHOST
-q_puppetmaster_dashboard_port=3000
-q_puppetmaster_install=y
-q_puppetmaster_use_dashboard_classifier=n
-q_puppetmaster_use_dashboard_reports=y
-q_rubydevelopment_install=y
-q_puppetdashboard_database_name=dbdb
-q_puppetdashboard_database_root_password=puppet
-q_puppetdashboard_database_user=puppet
-q_puppetdashboard_database_install=y
-q_puppetdashboard_database_password=puppet
-q_puppetdashboard_httpd_port=3000
-q_puppetdashboard_install=y
-]
-
# Agent and Dashboard answers
agent_dashboard_a = %q[
q_puppetdashboard_database_install=y
@@ -122,16 +98,22 @@
end
end
end
- # Host is only an Agent
- if role_agent && !role_master && !role_dashboard then
- step "host #{host} is agent only"
- File.open("tmp/q_agent_only", 'w') do |fh|
- agent_only_a.split(/\n/).each do |line| # Insert Puppet master host name
- if line =~ /(q_puppetagent_server=)MASTER/ then
- line = $1+master
- end
- fh.puts line
+ step "Generate Agent only answer file"
+ File.open("tmp/q_agent_only", 'w') do |fh|
+ agent_only_a.split(/\n/).each do |line| # Insert Puppet master host name
+ if line =~ /(q_puppetagent_server=)MASTER/ then
+ line = $1+master
end
+ fh.puts line
+ end
+ end
+ step "Generate Master only answer file"
+ File.open("tmp/q_master_only", 'w') do |fh|
+ master_only_a.split(/\n/).each do |line|
+ if line =~ /(q_puppetmaster_dashboard_hostname=)DASHBOARDHOST/ then
+ line = $1+dashboardhost
+ end
+ fh.puts line
end
end
# Host is Agent and Dashboard
@@ -146,30 +128,7 @@
end
end
end
- # Host is a Master only - no Dashboard
- if !role_agent && role_master && !role_dashboard then
- step "host #{host} is master only"
- File.open("tmp/q_master_only", 'w') do |fh|
- master_only_a.split(/\n/).each do |line|
- if line =~ /(q_puppetmaster_dashboard_hostname=)DASHBOARDHOST/ then
- line = $1+dashboardhost
- end
- fh.puts line
- end
- end
- end
- # Host is a Master and Dashboard
- if !role_agent && role_master && role_dashboard then
- step "host #{host} is master and dashboard"
- File.open("tmp/q_master_and_dashboard", 'w') do |fh|
- master_dashboard_a.split(/\n/).each do |line|
- if line =~ /(q_puppetmaster_dashboard_hostname=)DASHBOARDHOST/ then
- line = $1+dashboardhost
- end
- fh.puts line
- end
- end
- end
+
end
system("tar cf tmp/answers.tar tmp/q_*")
end #end if
@@ -25,26 +25,19 @@
# Install Master first -- allows for auto cert signing
hosts.each do |host|
next if !( host['roles'].include? 'master' )
- role_dashboard = host['roles'].include? 'dashboard'
platform = host['platform']
dist_dir = "puppet-enterprise-#{version}-#{platform}"
- q_script = case
- when (!role_dashboard); "q_master_only"
- when (role_dashboard); "q_master_and_dashboard"
- else Log.debug "Master warn #{host} has an unacceptable combination of roles."
- end
-
step "SCP Master Answer file to dist tar dir"
- scp_to host, "tmp/#{q_script}", "/tmp/#{dist_dir}"
+ scp_to host, "tmp/q_master_only", "/tmp/#{dist_dir}"
step "Install Puppet Master"
- on host,"cd /tmp/#{dist_dir} && ./puppet-enterprise-installer -a #{q_script}"
+ on host,"cd /tmp/#{dist_dir} && ./puppet-enterprise-installer -a q_master_only"
end
# Install Puppet Agents
step "Install Puppet Agent"
hosts.each do |host|
- next if host['roles'].include? 'master'
+ #next if host['roles'].include? 'master'
role_agent = host['roles'].include? 'agent'
role_dashboard = host['roles'].include? 'dashboard'
platform = host['platform']

0 comments on commit fe7cc3d

Please sign in to comment.