Class: Ridley::BootstrapContext::Unix
- Defined in:
- lib/ridley/bootstrap_context/unix.rb
Overview
Represents a binding that will be evaluated as an ERB template. When bootstrapping nodes, an instance of this class represents the customizable and necessary configurations needed by the Host in order to install and connect to Chef. By default, this class will be used when SSH is the best way to connect to the node.
Instance Attribute Summary collapse
-
#sudo ⇒ Object
readonly
Returns the value of attribute sudo.
Attributes inherited from Base
#attributes, #bootstrap_proxy, #chef_version, #encrypted_data_bag_secret, #environment, #hints, #node_name, #run_list, #server_url, #template_file, #validator_client, #validator_path
Instance Method Summary collapse
- #boot_command ⇒ String
- #bootstrap_directory ⇒ String
- #chef_config ⇒ String
- #chef_run ⇒ String
- #default_template ⇒ String
-
#initialize(options = {}) ⇒ Unix
constructor
A new instance of Unix.
Methods inherited from Base
#bootstrap_command, #first_boot, #template, #templates_path, validate_options, #validation_key
Constructor Details
#initialize(options = {}) ⇒ Unix
Returns a new instance of Unix.
12 13 14 15 16 |
# File 'lib/ridley/bootstrap_context/unix.rb', line 12 def initialize( = {}) = .reverse_merge(sudo: true) @sudo = [:sudo] super() end |
Instance Attribute Details
#sudo ⇒ Object (readonly)
Returns the value of attribute sudo.
8 9 10 |
# File 'lib/ridley/bootstrap_context/unix.rb', line 8 def sudo @sudo end |
Instance Method Details
#boot_command ⇒ String
19 20 21 |
# File 'lib/ridley/bootstrap_context/unix.rb', line 19 def boot_command template.evaluate(self) end |
#bootstrap_directory ⇒ String
51 52 53 |
# File 'lib/ridley/bootstrap_context/unix.rb', line 51 def bootstrap_directory "/etc/chef" end |
#chef_config ⇒ String
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 |
# File 'lib/ridley/bootstrap_context/unix.rb', line 24 def chef_config body = <<-CONFIG log_level :info log_location STDOUT chef_server_url "#{server_url}" validation_client_name "#{validator_client}" CONFIG if node_name.present? body << %Q{node_name "#{node_name}"\n} else body << "# Using default node name (fqdn)\n" end if bootstrap_proxy.present? body << %Q{http_proxy "#{bootstrap_proxy}"\n} body << %Q{https_proxy "#{bootstrap_proxy}"\n} end if encrypted_data_bag_secret.present? body << %Q{encrypted_data_bag_secret "#{bootstrap_directory}/encrypted_data_bag_secret"\n} end body end |
#chef_run ⇒ String
56 57 58 |
# File 'lib/ridley/bootstrap_context/unix.rb', line 56 def chef_run "chef-client -j #{bootstrap_directory}/first-boot.json -E #{environment}" end |
#default_template ⇒ String
61 62 63 |
# File 'lib/ridley/bootstrap_context/unix.rb', line 61 def default_template templates_path.join('unix_omnibus.erb').to_s end |