Last active
March 28, 2019 14:00
-
-
Save fh/6069112 to your computer and use it in GitHub Desktop.
Generating a Yaml Config file with Chef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= @content %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"config_content": { | |
"somestuff": { | |
"foo": "bar", | |
"bla": "batz" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "yaml" | |
template "/some/path/to/file.yml" do | |
mode 0644 | |
variables :content => YAML::dump(YAML::dump(config_content.to_hash).gsub('!map:Mash','')) | |
source "app.yml.erb" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
why not :
variables :content => config_content.to_hash.to_yaml
?