Class: Beaker::Version20 Private
- Defined in:
- lib/beaker/answers/version20.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
This class provides answer file information for PE version 2.0
Instance Method Summary collapse
-
#generate_answers ⇒ Hash
private
Return answer data for all hosts.
-
#host_answers(host, master, dashboard, options) ⇒ Hash
private
Return answer data for a host.
Methods inherited from Answers
#answer_for, #answer_string, #answers, create, #initialize
Constructor Details
This class inherits a constructor from Beaker::Answers
Instance Method Details
#generate_answers ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return answer data for all hosts.
107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/beaker/answers/version20.rb', line 107 def generate_answers the_answers = {} dashboard = only_host_with_role(@hosts, 'dashboard') master = only_host_with_role(@hosts, 'master') @hosts.each do |h| the_answers[h.name] = host_answers(h, master, dashboard, @options) if h[:custom_answers] the_answers[h.name] = the_answers[h.name].merge(h[:custom_answers]) end h[:answers] = the_answers[h.name] end return the_answers end |
#host_answers(host, master, dashboard, options) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return answer data for a host
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 |
# File 'lib/beaker/answers/version20.rb', line 15 def host_answers(host, master, dashboard, ) return nil if host['platform'] =~ /windows/ agent_a = { :q_install => 'y', :q_puppetagent_install => 'y', :q_puppet_cloud_install => 'y', :q_puppet_symlinks_install => 'y', :q_vendor_packages_install => 'y', :q_puppetagent_certname => host, :q_puppetagent_server => master, # Disable console and master by default # This will be overridden by other blocks being merged in :q_puppetmaster_install => 'n', :q_puppet_enterpriseconsole_install => 'n', } master_dns_altnames = [master.to_s, master['ip'], 'puppet'].compact.uniq.join(',') master_a = { :q_puppetmaster_install => 'y', :q_puppetmaster_certname => master, :q_puppetmaster_install => 'y', :q_puppetmaster_dnsaltnames => master_dns_altnames, :q_puppetmaster_enterpriseconsole_hostname => dashboard, :q_puppetmaster_enterpriseconsole_port => answer_for(, :q_puppetmaster_enterpriseconsole_port, 443), :q_puppetmaster_forward_facts => 'y', } dashboard_user = "'#{answer_for(, :q_puppet_enterpriseconsole_auth_user_email)}'" smtp_host = "'#{answer_for(, :q_puppet_enterpriseconsole_smtp_host, dashboard)}'" dashboard_password = "'#{answer_for(, :q_puppet_enterpriseconsole_auth_password)}'" smtp_port = "'#{answer_for(, :q_puppet_enterpriseconsole_smtp_port)}'" smtp_username = answer_for(, :q_puppet_enterpriseconsole_smtp_username) smtp_password = answer_for(, :q_puppet_enterpriseconsole_smtp_password) smtp_use_tls = "'#{answer_for(, :q_puppet_enterpriseconsole_smtp_use_tls)}'" auth_database_name = answer_for(, :q_puppet_enterpriseconsole_auth_database_name, 'console_auth') auth_database_user = answer_for(, :q_puppet_enterpriseconsole_auth_database_user, 'mYu7hu3r') console_database_name = answer_for(, :q_puppet_enterpriseconsole_database_name, 'console') console_database_user = answer_for(, :q_puppet_enterpriseconsole_database_user, 'mYc0nS03u3r') console_inventory_port = answer_for(, :q_puppet_enterpriseconsole_inventory_port, 8140) console_httpd_port = answer_for(, :q_puppet_enterpriseconsole_httpd_port, 443) console_a = { :q_puppet_enterpriseconsole_install => 'y', :q_puppet_enterpriseconsole_database_install => 'y', :q_puppet_enterpriseconsole_auth_database_name => auth_database_name, :q_puppet_enterpriseconsole_auth_database_user => auth_database_user, :q_puppet_enterpriseconsole_auth_database_password => dashboard_password, :q_puppet_enterpriseconsole_database_name => console_database_name, :q_puppet_enterpriseconsole_database_user => console_database_user, :q_puppet_enterpriseconsole_database_root_password => dashboard_password, :q_puppet_enterpriseconsole_database_password => dashboard_password, :q_puppet_enterpriseconsole_inventory_hostname => host, :q_puppet_enterpriseconsole_inventory_certname => host, :q_puppet_enterpriseconsole_inventory_dnsaltnames => master, :q_puppet_enterpriseconsole_inventory_port => console_inventory_port, :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 => console_httpd_port, :q_puppet_enterpriseconsole_smtp_host => smtp_host, :q_puppet_enterpriseconsole_smtp_use_tls => smtp_use_tls, :q_puppet_enterpriseconsole_smtp_port => smtp_port, } console_a[:q_puppet_enterpriseconsole_auth_user] = console_a[:q_puppet_enterpriseconsole_auth_user_email] 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 answers = agent_a.dup if host == master answers.merge! master_a end if host == dashboard answers.merge! console_a end return answers end |