I think you are looking for import_yaml
functionality.
YAML file var.yml
with some variables:
---
var1:
values:
val1: "string1"
val2: "string2"
An example.sls
state file:
{% import_yaml 'path/to/var.yml' as var_data %}
show-imported-variables:
module.run:
- name: test.echo
- text: {{ var_data['var1']['values'] }}
Now that the YAML file has been imported as var_data
we can access the values
within the dictionary.
When the state file is run:
----------
ret:
----------
val1:
string1
val2:
string2
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…