On Wed, Jul 2, 2014 at 12:00 PM, Alfredo Palhares
<
maste...@masterkorp.net> wrote:
> I have an application that is configurated by yaml, well salt pillar
> data is yaml, how can I quickly generate a yaml file from the pillar
> data to a configuration file.
Take a look at the yaml() Jinja filter. Just keep in mind the nested
templating that's going on here. If you're using any multi-line
strings or multi-line (pretty) YAML it's easy to mess up the
indentation.
http://docs.saltstack.com/en/latest/ref/renderers/all/salt.renderers.jinja.html#salt.utils.jinja.SerializerExtension
Something like this should be pretty safe:
/etc/myapp/config
file:
- managed
- contents: |
{{ salt['pillar.get']('myapp') | yaml() | indent(8) }}
The flow_control parameter to output pretty YAML is new in the
upcoming Salt feature release (Helium). In the 2014.1 release the YAML
will be output on a single line, I think.