Class: Kontena::Machine::CloudConfig::NodeGenerator
- Inherits:
-
Object
- Object
- Kontena::Machine::CloudConfig::NodeGenerator
- Defined in:
- lib/kontena/machine/cloud_config/node_generator.rb
Instance Method Summary collapse
Instance Method Details
#erb(template, vars) ⇒ Object
22 23 24 |
# File 'lib/kontena/machine/cloud_config/node_generator.rb', line 22 def erb(template, vars) ERB.new(template).result(OpenStruct.new(vars).instance_eval { binding }) end |
#generate(opts) ⇒ Object
10 11 12 |
# File 'lib/kontena/machine/cloud_config/node_generator.rb', line 10 def generate(opts) user_data(opts) end |
#user_data(vars) ⇒ Object
15 16 17 18 |
# File 'lib/kontena/machine/cloud_config/node_generator.rb', line 15 def user_data(vars) cloudinit_template = File.join(__dir__ , '/cloudinit.yml') erb(File.read(cloudinit_template), vars) end |