I have an config.yaml
file that defines some variables:
#config/product1/config.yaml
var_one: "url_1"
var_two: "url_2"
How can I read this file in a download.sls
file so that I can download files to /local/downloaded_files/
using URL's stored in config.yaml
?
I went through the salt-states
document but it's very lacking on implementation examples with code.
This can be done using import_yaml
in the following sort of fashion
# File: download.sls
#
# import your yaml data ...
{% import_yaml "config/product1/config.yaml" as config %}
# now you can use it ...
{{ config.var_one }}
Note that you can also use load_yaml
if you would like to define your data using yaml
inline within the state file itself
{% load_yaml as config %}
var_one: "url_1"
var_two: "url_2"
{% endload %}
{{ config.var_one }}