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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
# File 'lib/beaker/answers/version30.rb', line 5
def self.host_answers(host, master_certname, master, database, dashboard, options)
return nil if host['platform'] =~ /windows/
agent_a = {
:q_puppetagent_install => 'y',
:q_puppet_cloud_install => 'y',
:q_verify_packages => ENV['q_verify_packages'] || 'y',
:q_puppet_symlinks_install => 'y',
:q_puppetagent_certname => host,
:q_puppetagent_server => master,
:q_puppetmaster_install => 'n',
:q_all_in_one_install => 'n',
:q_puppet_enterpriseconsole_install => 'n',
:q_puppetdb_install => 'n',
:q_database_install => 'n',
}
common_a = {
:q_install => 'y',
:q_vendor_packages_install => 'y',
}
master_database_a = {
:q_puppetmaster_certname => master_certname
}
master_console_a = {
:q_puppetdb_hostname => database,
:q_puppetdb_port => 8081
}
master_a = {
:q_puppetmaster_install => 'y',
:q_puppetmaster_dnsaltnames => master_certname+",puppet",
:q_puppetmaster_enterpriseconsole_hostname => dashboard,
:q_puppetmaster_enterpriseconsole_port => 443,
}
if master['ip']
master_a[:q_puppetmaster_dnsaltnames]+=","+master['ip']
end
dashboard_password = "'#{ENV['q_puppet_enterpriseconsole_auth_password'] || '~!@#$%^*-/ aZ'}'"
puppetdb_password = "'#{ENV['q_puppetdb_password'] || '~!@#$%^*-/ aZ'}'"
console_database_a = {
:q_puppetdb_database_name => 'pe-puppetdb',
:q_puppetdb_database_user => 'mYpdBu3r',
:q_puppetdb_database_password => puppetdb_password,
:q_puppet_enterpriseconsole_auth_database_name => 'console_auth',
:q_puppet_enterpriseconsole_auth_database_user => 'mYu7hu3r',
:q_puppet_enterpriseconsole_auth_database_password => dashboard_password,
:q_puppet_enterpriseconsole_database_name => 'console',
:q_puppet_enterpriseconsole_database_user => 'mYc0nS03u3r',
:q_puppet_enterpriseconsole_database_password => dashboard_password,
:q_database_host => database,
:q_database_port => 5432
}
dashboard_user = "'#{ENV['q_puppet_enterpriseconsole_auth_user_email'] || '[email protected]'}'"
smtp_host = "'#{ENV['q_puppet_enterpriseconsole_smtp_host'] || dashboard}'"
smtp_port = "'#{ENV['q_puppet_enterpriseconsole_smtp_port'] || 25}'"
smtp_username = ENV['q_puppet_enterpriseconsole_smtp_username']
smtp_password = ENV['q_puppet_enterpriseconsole_smtp_password']
smtp_use_tls = "'#{ENV['q_puppet_enterpriseconsole_smtp_use_tls'] || 'n'}'"
console_a = {
:q_puppet_enterpriseconsole_install => 'y',
:q_puppet_enterpriseconsole_inventory_hostname => host,
:q_puppet_enterpriseconsole_inventory_certname => host,
:q_puppet_enterpriseconsole_inventory_dnsaltnames => dashboard,
:q_puppet_enterpriseconsole_inventory_port => 8140,
:q_puppet_enterpriseconsole_master_hostname => master,
:q_puppet_enterpriseconsole_auth_user_email => dashboard_user,
:q_puppet_enterpriseconsole_auth_password => dashboard_password,
:q_puppet_enterpriseconsole_httpd_port => 443,
:q_puppet_enterpriseconsole_smtp_host => smtp_host,
:q_puppet_enterpriseconsole_smtp_use_tls => smtp_use_tls,
:q_puppet_enterpriseconsole_smtp_port => smtp_port,
}
if smtp_password and smtp_username
console_a.merge!({
:q_puppet_enterpriseconsole_smtp_password => "'#{smtp_password}'",
:q_puppet_enterpriseconsole_smtp_username => "'#{smtp_username}'",
:q_puppet_enterpriseconsole_smtp_user_auth => 'y'
})
end
database_a = {
:q_puppetdb_install => 'y',
:q_database_install => 'y',
:q_database_root_password => "'=ZYdjiP3jCwV5eo9s1MBd'",
:q_database_root_user => 'pe-postgres',
}
aix_a = {
:q_run_updtvpkg => 'y',
}
answers = common_a.dup
unless options[:type] == :upgrade
answers.merge! agent_a
end
if host == master
answers.merge! master_console_a
unless options[:type] == :upgrade
answers.merge! master_a
answers.merge! master_database_a
end
end
if host == dashboard
answers.merge! master_console_a
answers.merge! console_database_a
answers[:q_pe_database] = 'y'
unless options[:type] == :upgrade
answers.merge! console_a
else
answers[:q_database_export_dir] = '/tmp'
end
end
if host == database
if database != master
if options[:type] == :upgrade
answers.merge! agent_a
end
answers.merge! master_database_a
end
answers.merge! database_a
answers.merge! console_database_a
end
if host == master and host == database and host == dashboard
answers[:q_all_in_one_install] = 'y'
end
if host['platform'].include? 'aix'
answers.merge! aix_a
end
return answers
end
|