beaker 1.19.1 → 1.20.0
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.
- checksums.yaml +8 -8
- data/HISTORY.md +295 -4
- data/README.md +4 -0
- data/lib/beaker/answers/version20.rb +103 -107
- data/lib/beaker/answers/version28.rb +111 -115
- data/lib/beaker/answers/version30.rb +194 -192
- data/lib/beaker/answers/version32.rb +27 -22
- data/lib/beaker/answers/version34.rb +6 -6
- data/lib/beaker/answers.rb +55 -21
- data/lib/beaker/cli.rb +13 -11
- data/lib/beaker/dsl/helpers.rb +2 -2
- data/lib/beaker/dsl/install_utils.rb +2 -4
- data/lib/beaker/host.rb +9 -5
- data/lib/beaker/host_prebuilt_steps.rb +33 -20
- data/lib/beaker/hypervisor/aws_sdk.rb +12 -10
- data/lib/beaker/hypervisor/ec2_helper.rb +1 -0
- data/lib/beaker/hypervisor/google_compute.rb +0 -1
- data/lib/beaker/hypervisor/vagrant.rb +11 -16
- data/lib/beaker/hypervisor/vagrant_fusion.rb +17 -0
- data/lib/beaker/hypervisor/vagrant_virtualbox.rb +26 -0
- data/lib/beaker/hypervisor/vagrant_workstation.rb +13 -0
- data/lib/beaker/hypervisor/vcloud_pooled.rb +3 -1
- data/lib/beaker/hypervisor.rb +22 -13
- data/lib/beaker/logger.rb +29 -0
- data/lib/beaker/options/command_line_parser.rb +2 -0
- data/lib/beaker/options/parser.rb +5 -4
- data/lib/beaker/options/presets.rb +58 -35
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/answers_spec.rb +156 -135
- data/spec/beaker/cli_spec.rb +35 -2
- data/spec/beaker/dsl/install_utils_spec.rb +2 -3
- data/spec/beaker/host_prebuilt_steps_spec.rb +47 -24
- data/spec/beaker/host_spec.rb +6 -6
- data/spec/beaker/hypervisor/ec2_helper_spec.rb +2 -2
- data/spec/beaker/hypervisor/hypervisor_spec.rb +35 -0
- data/spec/beaker/hypervisor/vagrant_fusion_spec.rb +34 -0
- data/spec/beaker/hypervisor/vagrant_spec.rb +39 -2
- data/spec/beaker/hypervisor/vagrant_virtualbox_spec.rb +34 -0
- data/spec/beaker/hypervisor/vagrant_workstation_spec.rb +34 -0
- data/spec/beaker/logger_spec.rb +30 -0
- data/spec/beaker/options/presets_spec.rb +4 -4
- data/spec/helpers.rb +2 -1
- data/spec/mocks.rb +5 -1
- metadata +9 -60
@@ -1,126 +1,122 @@
|
|
1
1
|
module Beaker
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
module Version28
|
7
|
-
|
8
|
-
# Return answer data for a host
|
9
|
-
#
|
10
|
-
# @param [Beaker::Host] host Host to return data for
|
11
|
-
# @param [String] master_certname Hostname of the puppet master.
|
12
|
-
# @param [Beaker::Host] master Host object representing the master
|
13
|
-
# @param [Beaker::Host] dashboard Host object representing the dashboard
|
14
|
-
# @param [Hash] options options for answer files
|
15
|
-
# @option options [Symbol] :type Should be one of :upgrade or :install.
|
16
|
-
# @return [Hash] A hash (keyed from hosts) containing hashes of answer file
|
17
|
-
# data.
|
18
|
-
def self.host_answers(host, master_certname, master, dashboard, options)
|
19
|
-
return nil if host['platform'] =~ /windows/
|
20
|
-
|
21
|
-
agent_a = {
|
22
|
-
:q_install => 'y',
|
23
|
-
:q_puppetagent_install => 'y',
|
24
|
-
:q_puppet_cloud_install => 'y',
|
25
|
-
:q_puppet_symlinks_install => 'y',
|
26
|
-
:q_vendor_packages_install => 'y',
|
27
|
-
:q_puppetagent_certname => host,
|
28
|
-
:q_puppetagent_server => master,
|
29
|
-
|
30
|
-
# Disable console and master by default
|
31
|
-
# This will be overridden by other blocks being merged in
|
32
|
-
:q_puppetmaster_install => 'n',
|
33
|
-
:q_puppet_enterpriseconsole_install => 'n',
|
34
|
-
}
|
35
|
-
|
36
|
-
master_a = {
|
37
|
-
:q_puppetmaster_install => 'y',
|
38
|
-
:q_puppetmaster_certname => master_certname,
|
39
|
-
:q_puppetmaster_install => 'y',
|
40
|
-
:q_puppetmaster_dnsaltnames => master_certname+",puppet",
|
41
|
-
:q_puppetmaster_enterpriseconsole_hostname => dashboard,
|
42
|
-
:q_puppetmaster_enterpriseconsole_port => 443,
|
43
|
-
:q_puppetmaster_forward_facts => 'y',
|
44
|
-
}
|
45
|
-
|
46
|
-
if master['ip']
|
47
|
-
master_a[:q_puppetmaster_dnsaltnames]+=","+master['ip']
|
48
|
-
end
|
49
|
-
|
50
|
-
dashboard_user = "'#{options[:answers][:q_puppet_enterpriseconsole_auth_user_email]}'"
|
51
|
-
smtp_host = "'#{options[:answers][:q_puppet_enterpriseconsole_smtp_host] || dashboard}'"
|
52
|
-
dashboard_password = options[:answers][:q_puppet_enterpriseconsole_auth_password]
|
53
|
-
smtp_port = "'#{options[:answers][:q_puppet_enterpriseconsole_smtp_port]}'"
|
54
|
-
smtp_username = options[:answers][:q_puppet_enterpriseconsole_smtp_username]
|
55
|
-
smtp_password = options[:answers][:q_puppet_enterpriseconsole_smtp_password]
|
56
|
-
smtp_use_tls = "'#{options[:answers][:q_puppet_enterpriseconsole_smtp_use_tls]}'"
|
57
|
-
|
58
|
-
console_a = {
|
59
|
-
:q_puppet_enterpriseconsole_install => 'y',
|
60
|
-
:q_puppet_enterpriseconsole_database_install => 'y',
|
61
|
-
:q_puppet_enterpriseconsole_auth_database_name => 'console_auth',
|
62
|
-
:q_puppet_enterpriseconsole_auth_database_user => 'mYu7hu3r',
|
63
|
-
:q_puppet_enterpriseconsole_auth_database_password => "'#{dashboard_password}'",
|
64
|
-
:q_puppet_enterpriseconsole_database_name => 'console',
|
65
|
-
:q_puppet_enterpriseconsole_database_user => 'mYc0nS03u3r',
|
66
|
-
:q_puppet_enterpriseconsole_database_password => "'#{dashboard_password}'",
|
67
|
-
:q_puppet_enterpriseconsole_inventory_hostname => host,
|
68
|
-
:q_puppet_enterpriseconsole_inventory_certname => host,
|
69
|
-
:q_puppet_enterpriseconsole_inventory_dnsaltnames => master,
|
70
|
-
:q_puppet_enterpriseconsole_inventory_port => 8140,
|
71
|
-
:q_puppet_enterpriseconsole_master_hostname => master,
|
72
|
-
|
73
|
-
:q_puppet_enterpriseconsole_auth_user_email => dashboard_user,
|
74
|
-
:q_puppet_enterpriseconsole_auth_password => "'#{dashboard_password}'",
|
75
|
-
|
76
|
-
:q_puppet_enterpriseconsole_httpd_port => 443,
|
77
|
-
|
78
|
-
:q_puppet_enterpriseconsole_smtp_host => smtp_host,
|
79
|
-
:q_puppet_enterpriseconsole_smtp_use_tls => smtp_use_tls,
|
80
|
-
:q_puppet_enterpriseconsole_smtp_port => smtp_port,
|
81
|
-
}
|
82
|
-
|
83
|
-
console_a[:q_puppet_enterpriseconsole_auth_user] = console_a[:q_puppet_enterpriseconsole_auth_user_email]
|
2
|
+
# This class provides answer file information for PE version 2.8
|
3
|
+
#
|
4
|
+
# @api private
|
5
|
+
class Version28 < Answers
|
84
6
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
7
|
+
# Return answer data for a host
|
8
|
+
#
|
9
|
+
# @param [Beaker::Host] host Host to return data for
|
10
|
+
# @param [Beaker::Host] master Host object representing the master
|
11
|
+
# @param [Beaker::Host] dashboard Host object representing the dashboard
|
12
|
+
# @param [Hash] options options for answer files
|
13
|
+
# @option options [Symbol] :type Should be one of :upgrade or :install.
|
14
|
+
# @return [Hash] A hash (keyed from hosts) containing hashes of answer file
|
15
|
+
# data.
|
16
|
+
def host_answers(host, master, dashboard, options)
|
17
|
+
return nil if host['platform'] =~ /windows/
|
18
|
+
|
19
|
+
agent_a = {
|
20
|
+
:q_install => 'y',
|
21
|
+
:q_puppetagent_install => 'y',
|
22
|
+
:q_puppet_cloud_install => 'y',
|
23
|
+
:q_puppet_symlinks_install => 'y',
|
24
|
+
:q_vendor_packages_install => 'y',
|
25
|
+
:q_puppetagent_certname => host,
|
26
|
+
:q_puppetagent_server => master,
|
27
|
+
|
28
|
+
# Disable console and master by default
|
29
|
+
# This will be overridden by other blocks being merged in
|
30
|
+
:q_puppetmaster_install => 'n',
|
31
|
+
:q_puppet_enterpriseconsole_install => 'n',
|
32
|
+
}
|
33
|
+
|
34
|
+
master_dns_altnames = [master.to_s, master['ip'], 'puppet'].compact.uniq.join(',')
|
35
|
+
master_a = {
|
36
|
+
:q_puppetmaster_install => 'y',
|
37
|
+
:q_puppetmaster_certname => master,
|
38
|
+
:q_puppetmaster_install => 'y',
|
39
|
+
:q_puppetmaster_dnsaltnames => master_dns_altnames,
|
40
|
+
:q_puppetmaster_enterpriseconsole_hostname => dashboard,
|
41
|
+
:q_puppetmaster_enterpriseconsole_port => answer_for(options, :q_puppetmaster_enterpriseconsole_port, 443),
|
42
|
+
:q_puppetmaster_forward_facts => 'y',
|
43
|
+
}
|
44
|
+
|
45
|
+
dashboard_user = "'#{answer_for(options, :q_puppet_enterpriseconsole_auth_user_email)}'"
|
46
|
+
smtp_host = "'#{answer_for(options, :q_puppet_enterpriseconsole_smtp_host, dashboard)}'"
|
47
|
+
dashboard_password = "'#{answer_for(options, :q_puppet_enterpriseconsole_auth_password)}'"
|
48
|
+
smtp_port = "'#{answer_for(options, :q_puppet_enterpriseconsole_smtp_port)}'"
|
49
|
+
smtp_username = answer_for(options, :q_puppet_enterpriseconsole_smtp_username)
|
50
|
+
smtp_password = answer_for(options, :q_puppet_enterpriseconsole_smtp_password)
|
51
|
+
smtp_use_tls = "'#{answer_for(options, :q_puppet_enterpriseconsole_smtp_use_tls)}'"
|
52
|
+
auth_database_name = answer_for(options, :q_puppet_enterpriseconsole_auth_database_name, 'console_auth')
|
53
|
+
auth_database_user = answer_for(options, :q_puppet_enterpriseconsole_auth_database_user, 'mYu7hu3r')
|
54
|
+
console_database_name = answer_for(options, :q_puppet_enterpriseconsole_database_name, 'console')
|
55
|
+
console_database_user = answer_for(options, :q_puppet_enterpriseconsole_database_user, 'mYc0nS03u3r')
|
56
|
+
console_inventory_port = answer_for(options, :q_puppet_enterpriseconsole_inventory_port, 8140)
|
57
|
+
console_httpd_port = answer_for(options, :q_puppet_enterpriseconsole_httpd_port, 443)
|
58
|
+
|
59
|
+
console_a = {
|
60
|
+
:q_puppet_enterpriseconsole_install => 'y',
|
61
|
+
:q_puppet_enterpriseconsole_database_install => 'y',
|
62
|
+
:q_puppet_enterpriseconsole_auth_database_name => auth_database_name,
|
63
|
+
:q_puppet_enterpriseconsole_auth_database_user => auth_database_user,
|
64
|
+
:q_puppet_enterpriseconsole_auth_database_password => dashboard_password,
|
65
|
+
:q_puppet_enterpriseconsole_database_name => console_database_name,
|
66
|
+
:q_puppet_enterpriseconsole_database_user => console_database_user,
|
67
|
+
:q_puppet_enterpriseconsole_database_password => dashboard_password,
|
68
|
+
:q_puppet_enterpriseconsole_inventory_hostname => host,
|
69
|
+
:q_puppet_enterpriseconsole_inventory_certname => host,
|
70
|
+
:q_puppet_enterpriseconsole_inventory_dnsaltnames => master,
|
71
|
+
:q_puppet_enterpriseconsole_inventory_port => console_inventory_port,
|
72
|
+
:q_puppet_enterpriseconsole_master_hostname => master,
|
73
|
+
:q_puppet_enterpriseconsole_auth_user_email => dashboard_user,
|
74
|
+
:q_puppet_enterpriseconsole_auth_password => dashboard_password,
|
75
|
+
:q_puppet_enterpriseconsole_httpd_port => console_httpd_port,
|
76
|
+
:q_puppet_enterpriseconsole_smtp_host => smtp_host,
|
77
|
+
:q_puppet_enterpriseconsole_smtp_use_tls => smtp_use_tls,
|
78
|
+
:q_puppet_enterpriseconsole_smtp_port => smtp_port,
|
79
|
+
}
|
80
|
+
|
81
|
+
console_a[:q_puppet_enterpriseconsole_auth_user] = console_a[:q_puppet_enterpriseconsole_auth_user_email]
|
82
|
+
|
83
|
+
if smtp_password and smtp_username
|
84
|
+
console_a.merge!({
|
85
|
+
:q_puppet_enterpriseconsole_smtp_password => "'#{smtp_password}'",
|
86
|
+
:q_puppet_enterpriseconsole_smtp_username => "'#{smtp_username}'",
|
87
|
+
:q_puppet_enterpriseconsole_smtp_user_auth => 'y'
|
88
|
+
})
|
89
|
+
end
|
97
90
|
|
98
|
-
|
99
|
-
|
100
|
-
|
91
|
+
answers = agent_a.dup
|
92
|
+
if host == master
|
93
|
+
answers.merge! master_a
|
94
|
+
end
|
101
95
|
|
102
|
-
|
96
|
+
if host == dashboard
|
97
|
+
answers.merge! console_a
|
103
98
|
end
|
104
99
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
h
|
100
|
+
return answers
|
101
|
+
end
|
102
|
+
|
103
|
+
# Return answer data for all hosts.
|
104
|
+
#
|
105
|
+
# @return [Hash] A hash (keyed from hosts) containing hashes of answer file
|
106
|
+
# data.
|
107
|
+
def generate_answers
|
108
|
+
the_answers = {}
|
109
|
+
dashboard = only_host_with_role(@hosts, 'dashboard')
|
110
|
+
master = only_host_with_role(@hosts, 'master')
|
111
|
+
@hosts.each do |h|
|
112
|
+
the_answers[h.name] = host_answers(h, master, dashboard, @options)
|
113
|
+
if h[:custom_answers]
|
114
|
+
the_answers[h.name] = the_answers[h.name].merge(h[:custom_answers])
|
120
115
|
end
|
121
|
-
|
116
|
+
h[:answers] = the_answers[h.name]
|
122
117
|
end
|
123
|
-
|
118
|
+
return the_answers
|
124
119
|
end
|
120
|
+
|
125
121
|
end
|
126
122
|
end
|
@@ -1,215 +1,217 @@
|
|
1
1
|
module Beaker
|
2
|
-
|
3
|
-
|
2
|
+
# This class provides answer file information for PE version 3.x
|
3
|
+
#
|
4
|
+
# @api private
|
5
|
+
class Version30 < Answers
|
6
|
+
# Return answer data for a host
|
4
7
|
#
|
5
|
-
# @
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
#
|
14
|
-
|
15
|
-
|
16
|
-
#
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
8
|
+
# @param [Beaker::Host] host Host to return data for
|
9
|
+
# @param [Beaker::Host] master Host object representing the master
|
10
|
+
# @param [Beaker::Host] dashboard Host object representing the dashboard
|
11
|
+
# @param [Hash] options options for answer files
|
12
|
+
# @option options [Symbol] :type Should be one of :upgrade or :install.
|
13
|
+
# @return [Hash] A hash (keyed from hosts) containing hashes of answer file
|
14
|
+
# data.
|
15
|
+
def host_answers(host, master, database, dashboard, options)
|
16
|
+
# Windows hosts don't have normal answers...
|
17
|
+
return nil if host['platform'] =~ /windows/
|
18
|
+
|
19
|
+
# Everything's an agent
|
20
|
+
agent_a = {
|
21
|
+
:q_puppetagent_install => 'y',
|
22
|
+
:q_puppet_cloud_install => 'y',
|
23
|
+
:q_verify_packages => options[:answers][:q_verify_packages],
|
24
|
+
:q_puppet_symlinks_install => 'y',
|
25
|
+
:q_puppetagent_certname => host,
|
26
|
+
:q_puppetagent_server => master,
|
27
|
+
|
28
|
+
# Disable database, console, and master by default
|
29
|
+
# This will be overridden by other blocks being merged in.
|
30
|
+
:q_puppetmaster_install => 'n',
|
31
|
+
:q_all_in_one_install => 'n',
|
32
|
+
:q_puppet_enterpriseconsole_install => 'n',
|
33
|
+
:q_puppetdb_install => 'n',
|
34
|
+
:q_database_install => 'n',
|
35
|
+
}
|
36
|
+
|
37
|
+
# These base answers are needed by all
|
38
|
+
common_a = {
|
39
|
+
:q_install => 'y',
|
40
|
+
:q_vendor_packages_install => 'y',
|
41
|
+
}
|
42
|
+
|
43
|
+
# master/database answers
|
44
|
+
master_database_a = {
|
45
|
+
:q_puppetmaster_certname => master
|
46
|
+
}
|
47
|
+
|
48
|
+
# Master/dashboard answers
|
49
|
+
master_console_a = {
|
50
|
+
:q_puppetdb_hostname => database,
|
51
|
+
:q_puppetdb_port => answer_for(options, :q_puppetdb_port, 8081)
|
52
|
+
}
|
53
|
+
|
54
|
+
# Master only answers
|
55
|
+
master_dns_altnames = [master.to_s, master['ip'], 'puppet'].compact.uniq.join(',')
|
56
|
+
master_a = {
|
57
|
+
:q_puppetmaster_install => 'y',
|
58
|
+
:q_puppetmaster_dnsaltnames => master_dns_altnames,
|
59
|
+
:q_puppetmaster_enterpriseconsole_hostname => dashboard,
|
60
|
+
:q_puppetmaster_enterpriseconsole_port => answer_for(options, :q_puppetmaster_enterpriseconsole_port, 443),
|
61
|
+
}
|
62
|
+
|
63
|
+
# Common answers for console and database
|
64
|
+
database_name = answer_for(options, :q_puppetdb_database_name, 'pe-puppetdb')
|
65
|
+
database_user = answer_for(options, :q_puppetdb_database_user, 'mYpdBu3r')
|
66
|
+
dashboard_password = "'#{options[:answers][:q_puppet_enterpriseconsole_auth_password]}'"
|
67
|
+
puppetdb_password = "'#{options[:answers][:q_puppetdb_password]}'"
|
68
|
+
auth_database_name = answer_for(options, :q_puppet_enterpriseconsole_auth_database_name, 'console_auth')
|
69
|
+
auth_database_user = answer_for(options, :q_puppet_enterpriseconsole_auth_database_user, 'mYu7hu3r')
|
70
|
+
console_database_name = answer_for(options, :q_puppet_enterpriseconsole_database_name, 'console')
|
71
|
+
console_database_user = answer_for(options, :q_puppet_enterpriseconsole_database_user, 'mYc0nS03u3r')
|
72
|
+
database_port = answer_for(options, :q_database_port, 5432)
|
73
|
+
|
74
|
+
console_database_a = {
|
75
|
+
:q_puppetdb_database_name => database_name,
|
76
|
+
:q_puppetdb_database_user => database_user,
|
77
|
+
:q_puppetdb_database_password => puppetdb_password,
|
78
|
+
:q_puppet_enterpriseconsole_auth_database_name => auth_database_name,
|
79
|
+
:q_puppet_enterpriseconsole_auth_database_user => auth_database_user,
|
80
|
+
:q_puppet_enterpriseconsole_auth_database_password => dashboard_password,
|
81
|
+
:q_puppet_enterpriseconsole_database_name => console_database_name,
|
82
|
+
:q_puppet_enterpriseconsole_database_user => console_database_user,
|
83
|
+
:q_puppet_enterpriseconsole_database_password => dashboard_password,
|
84
|
+
|
85
|
+
:q_database_host => database,
|
86
|
+
:q_database_port => database_port,
|
87
|
+
}
|
88
|
+
|
89
|
+
# Console only answers
|
90
|
+
dashboard_user = "'#{options[:answers][:q_puppet_enterpriseconsole_auth_user_email]}'"
|
91
|
+
|
92
|
+
|
93
|
+
smtp_host = "'#{options[:answers][:q_puppet_enterpriseconsole_smtp_host] || dashboard}'"
|
94
|
+
smtp_port = "'#{options[:answers][:q_puppet_enterpriseconsole_smtp_port]}'"
|
95
|
+
smtp_username = options[:answers][:q_puppet_enterpriseconsole_smtp_username]
|
96
|
+
smtp_password = options[:answers][:q_puppet_enterpriseconsole_smtp_password]
|
97
|
+
smtp_use_tls = "'#{options[:answers][:q_puppet_enterpriseconsole_smtp_use_tls]}'"
|
98
|
+
console_inventory_port = answer_for(options, :q_puppet_enterpriseconsole_inventory_port, 8140)
|
99
|
+
console_httpd_port = answer_for(options, :q_puppet_enterpriseconsole_httpd_port, 443)
|
100
|
+
|
101
|
+
console_a = {
|
102
|
+
:q_puppet_enterpriseconsole_install => 'y',
|
103
|
+
:q_puppet_enterpriseconsole_inventory_hostname => host,
|
104
|
+
:q_puppet_enterpriseconsole_inventory_certname => host,
|
105
|
+
:q_puppet_enterpriseconsole_inventory_dnsaltnames => dashboard,
|
106
|
+
:q_puppet_enterpriseconsole_inventory_port => console_inventory_port,
|
107
|
+
:q_puppet_enterpriseconsole_master_hostname => master,
|
108
|
+
|
109
|
+
:q_puppet_enterpriseconsole_auth_user_email => dashboard_user,
|
110
|
+
:q_puppet_enterpriseconsole_auth_password => dashboard_password,
|
111
|
+
|
112
|
+
:q_puppet_enterpriseconsole_httpd_port => console_httpd_port,
|
113
|
+
|
114
|
+
:q_puppet_enterpriseconsole_smtp_host => smtp_host,
|
115
|
+
:q_puppet_enterpriseconsole_smtp_use_tls => smtp_use_tls,
|
116
|
+
:q_puppet_enterpriseconsole_smtp_port => smtp_port,
|
117
|
+
}
|
118
|
+
|
119
|
+
if smtp_password and smtp_username
|
120
|
+
console_a.merge!({
|
121
|
+
:q_puppet_enterpriseconsole_smtp_password => "'#{smtp_password}'",
|
122
|
+
:q_puppet_enterpriseconsole_smtp_username => "'#{smtp_username}'",
|
123
|
+
:q_puppet_enterpriseconsole_smtp_user_auth => 'y'
|
124
|
+
})
|
125
|
+
end
|
67
126
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
:q_puppetdb_database_password => puppetdb_password,
|
76
|
-
:q_puppet_enterpriseconsole_auth_database_name => 'console_auth',
|
77
|
-
:q_puppet_enterpriseconsole_auth_database_user => 'mYu7hu3r',
|
78
|
-
:q_puppet_enterpriseconsole_auth_database_password => dashboard_password,
|
79
|
-
:q_puppet_enterpriseconsole_database_name => 'console',
|
80
|
-
:q_puppet_enterpriseconsole_database_user => 'mYc0nS03u3r',
|
81
|
-
:q_puppet_enterpriseconsole_database_password => dashboard_password,
|
82
|
-
|
83
|
-
:q_database_host => database,
|
84
|
-
:q_database_port => 5432
|
85
|
-
}
|
86
|
-
|
87
|
-
# Console only answers
|
88
|
-
dashboard_user = "'#{options[:answers][:q_puppet_enterpriseconsole_auth_user_email]}'"
|
89
|
-
|
90
|
-
|
91
|
-
smtp_host = "'#{options[:answers][:q_puppet_enterpriseconsole_smtp_host] || dashboard}'"
|
92
|
-
smtp_port = "'#{options[:answers][:q_puppet_enterpriseconsole_smtp_port]}'"
|
93
|
-
smtp_username = options[:answers][:q_puppet_enterpriseconsole_smtp_username]
|
94
|
-
smtp_password = options[:answers][:q_puppet_enterpriseconsole_smtp_password]
|
95
|
-
smtp_use_tls = "'#{options[:answers][:q_puppet_enterpriseconsole_smtp_use_tls]}'"
|
96
|
-
|
97
|
-
console_a = {
|
98
|
-
:q_puppet_enterpriseconsole_install => 'y',
|
99
|
-
:q_puppet_enterpriseconsole_inventory_hostname => host,
|
100
|
-
:q_puppet_enterpriseconsole_inventory_certname => host,
|
101
|
-
:q_puppet_enterpriseconsole_inventory_dnsaltnames => dashboard,
|
102
|
-
:q_puppet_enterpriseconsole_inventory_port => 8140,
|
103
|
-
:q_puppet_enterpriseconsole_master_hostname => master,
|
104
|
-
|
105
|
-
:q_puppet_enterpriseconsole_auth_user_email => dashboard_user,
|
106
|
-
:q_puppet_enterpriseconsole_auth_password => dashboard_password,
|
107
|
-
|
108
|
-
:q_puppet_enterpriseconsole_httpd_port => 443,
|
109
|
-
|
110
|
-
:q_puppet_enterpriseconsole_smtp_host => smtp_host,
|
111
|
-
:q_puppet_enterpriseconsole_smtp_use_tls => smtp_use_tls,
|
112
|
-
:q_puppet_enterpriseconsole_smtp_port => smtp_port,
|
113
|
-
}
|
114
|
-
|
115
|
-
if smtp_password and smtp_username
|
116
|
-
console_a.merge!({
|
117
|
-
:q_puppet_enterpriseconsole_smtp_password => "'#{smtp_password}'",
|
118
|
-
:q_puppet_enterpriseconsole_smtp_username => "'#{smtp_username}'",
|
119
|
-
:q_puppet_enterpriseconsole_smtp_user_auth => 'y'
|
120
|
-
})
|
121
|
-
end
|
127
|
+
# Database only answers
|
128
|
+
database_a = {
|
129
|
+
:q_puppetdb_install => 'y',
|
130
|
+
:q_database_install => 'y',
|
131
|
+
:q_database_root_password => "'#{answer_for(options, :q_database_root_password, '=ZYdjiP3jCwV5eo9s1MBd')}'",
|
132
|
+
:q_database_root_user => answer_for(options, :q_database_root_user, 'pe-postgres'),
|
133
|
+
}
|
122
134
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
:q_database_root_password => "'=ZYdjiP3jCwV5eo9s1MBd'",
|
128
|
-
:q_database_root_user => 'pe-postgres',
|
129
|
-
}
|
135
|
+
# Special answers for special hosts
|
136
|
+
aix_a = {
|
137
|
+
:q_run_updtvpkg => 'y',
|
138
|
+
}
|
130
139
|
|
131
|
-
|
132
|
-
aix_a = {
|
133
|
-
:q_run_updtvpkg => 'y',
|
134
|
-
}
|
140
|
+
answers = common_a.dup
|
135
141
|
|
136
|
-
|
142
|
+
unless options[:type] == :upgrade
|
143
|
+
answers.merge! agent_a
|
144
|
+
end
|
137
145
|
|
146
|
+
if host == master
|
147
|
+
answers.merge! master_console_a
|
138
148
|
unless options[:type] == :upgrade
|
139
|
-
answers.merge!
|
140
|
-
|
141
|
-
|
142
|
-
if host == master
|
143
|
-
answers.merge! master_console_a
|
144
|
-
unless options[:type] == :upgrade
|
145
|
-
answers.merge! master_a
|
146
|
-
answers.merge! master_database_a
|
147
|
-
end
|
149
|
+
answers.merge! master_a
|
150
|
+
answers.merge! master_database_a
|
148
151
|
end
|
152
|
+
end
|
149
153
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
end
|
154
|
+
if host == dashboard
|
155
|
+
answers.merge! master_console_a
|
156
|
+
answers.merge! console_database_a
|
157
|
+
answers[:q_pe_database] = 'y'
|
158
|
+
unless options[:type] == :upgrade
|
159
|
+
answers.merge! console_a
|
160
|
+
else
|
161
|
+
answers[:q_database_export_dir] = answer_for(options, :q_database_export_dir, '/tmp')
|
159
162
|
end
|
163
|
+
end
|
160
164
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
end
|
169
|
-
answers.merge! master_database_a
|
165
|
+
if host == database
|
166
|
+
if database != master
|
167
|
+
if options[:type] == :upgrade
|
168
|
+
# This is kinda annoying - if we're upgrading to 3.0 and are
|
169
|
+
# puppetdb, we're actually doing a clean install. We thus
|
170
|
+
# need the core agent answers.
|
171
|
+
answers.merge! agent_a
|
170
172
|
end
|
171
|
-
answers.merge!
|
172
|
-
answers.merge! console_database_a
|
173
|
-
end
|
174
|
-
|
175
|
-
if host == master and host == database and host == dashboard
|
176
|
-
answers[:q_all_in_one_install] = 'y'
|
173
|
+
answers.merge! master_database_a
|
177
174
|
end
|
175
|
+
answers.merge! database_a
|
176
|
+
answers.merge! console_database_a
|
177
|
+
end
|
178
178
|
|
179
|
-
|
180
|
-
|
181
|
-
|
179
|
+
if host == master and host == database and host == dashboard
|
180
|
+
answers[:q_all_in_one_install] = 'y'
|
181
|
+
end
|
182
182
|
|
183
|
-
|
183
|
+
if host['platform'].include? 'aix'
|
184
|
+
answers.merge! aix_a
|
184
185
|
end
|
185
186
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
h
|
187
|
+
return answers
|
188
|
+
end
|
189
|
+
|
190
|
+
# Return answer data for all hosts.
|
191
|
+
#
|
192
|
+
# @return [Hash] A hash (keyed from hosts) containing hashes of answer file
|
193
|
+
# data.
|
194
|
+
def generate_answers
|
195
|
+
the_answers = {}
|
196
|
+
database = only_host_with_role(@hosts, 'database')
|
197
|
+
dashboard = only_host_with_role(@hosts, 'dashboard')
|
198
|
+
master = only_host_with_role(@hosts, 'master')
|
199
|
+
@hosts.each do |h|
|
200
|
+
if @options[:type] == :upgrade and h[:pe_ver] =~ /\A3.0/
|
201
|
+
# 3.0.x to 3.0.x should require no answers
|
202
|
+
the_answers[h.name] = {
|
203
|
+
:q_install => 'y',
|
204
|
+
:q_install_vendor_packages => 'y',
|
205
|
+
}
|
206
|
+
else
|
207
|
+
the_answers[h.name] = host_answers(h, master, database, dashboard, @options)
|
208
|
+
end
|
209
|
+
if h[:custom_answers]
|
210
|
+
the_answers[h.name] = the_answers[h.name].merge(h[:custom_answers])
|
210
211
|
end
|
211
|
-
|
212
|
+
h[:answers] = the_answers[h.name]
|
212
213
|
end
|
214
|
+
return the_answers
|
213
215
|
end
|
214
216
|
end
|
215
217
|
end
|