Module: Beaker::Answers::Version28 Private
- Defined in:
- lib/beaker/answers/version28.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
This class provides answer file information for PE version 2.8
Class Method Summary collapse
-
.answers(hosts, master_certname, options) ⇒ Hash
private
Return answer data for all hosts.
-
.host_answers(host, master_certname, master, dashboard, options) ⇒ Hash
private
Return answer data for a host.
Class Method Details
.answers(hosts, master_certname, 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 all hosts.
113 114 115 116 117 118 119 120 121 122 |
# File 'lib/beaker/answers/version28.rb', line 113 def self.answers(hosts, master_certname, ) 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_certname, master, dashboard, ) h[:answers] = the_answers[h.name] end return the_answers end |
.host_answers(host, master_certname, 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
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 |
# File 'lib/beaker/answers/version28.rb', line 18 def self.host_answers(host, master_certname, 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_a = { :q_puppetmaster_install => 'y', :q_puppetmaster_certname => master_certname, :q_puppetmaster_install => 'y', :q_puppetmaster_dnsaltnames => master_certname+",puppet", :q_puppetmaster_enterpriseconsole_hostname => dashboard, :q_puppetmaster_enterpriseconsole_port => 443, :q_puppetmaster_forward_facts => 'y', } if master['ip'] master_a[:q_puppetmaster_dnsaltnames]+=","+master['ip'] end dashboard_user = "'#{[:answers][:q_puppet_enterpriseconsole_auth_user_email]}'" smtp_host = "'#{[:answers][:q_puppet_enterpriseconsole_smtp_host] || dashboard}'" dashboard_password = [:answers][:q_puppet_enterpriseconsole_auth_password] smtp_port = "'#{[:answers][:q_puppet_enterpriseconsole_smtp_port]}'" smtp_username = [:answers][:q_puppet_enterpriseconsole_smtp_username] smtp_password = [:answers][:q_puppet_enterpriseconsole_smtp_password] smtp_use_tls = "'#{[:answers][:q_puppet_enterpriseconsole_smtp_use_tls]}'" console_a = { :q_puppet_enterpriseconsole_install => 'y', :q_puppet_enterpriseconsole_database_install => 'y', :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_puppet_enterpriseconsole_inventory_hostname => host, :q_puppet_enterpriseconsole_inventory_certname => host, :q_puppet_enterpriseconsole_inventory_dnsaltnames => master, :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, } 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 |