erb - How to test templates with hiera data locally? -


I'm trying to get an erb template file and remove a way to use Hierra data (even here That also use a yaml file)) and just templates to create a file with the replaced values.

Have you ever tried to do something like this? My first thought is to write a ruby ​​script, but maybe this is a simple solution.

Thanks in advance.

Edit: Since it can not be clear, I use the interpretation of the case.

I want all the application configurations to be templates and committed by developers and I want to give them an automatic way to fill those templates on those local machines (laptops) without using puppet. Additional benefits are actually the validity of the templates before submitting them.

I'm not sure why you want it to be done directly with Hierra data, but this is ERB And implementing with yaml ruby ​​libs will be easy. Something like this (SUUO-code):

  Class Arbiter requires' Erb '' yaml attr_accessor: output_path ,: yaml_path def initialize (template, command) @output =: output_path @ Data =: yaml_ path ..... enddef render () ERB.new (@template) .rlt (binding) and deaf safe file. Open (file, "W +"). F | F.write (render) end end def parse_yaml (@data) File.open (@data, ... # Parsing some stuff, add them to local {} and end  

, You can make an example of this class like:

  newTemplate = Erbwritter.new (/ path / to / output, / path / to / yaml) newTemplate.save (file.join (Dir.pwd, again, it's basically psudo code and will not work out of the box, but it's very close. 

You can read more about the ERB class. .


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -