给定一个名为package-list的文件,我想做类似的事情:
salt state.sls install-packages list_to_install=package-list
...然后在sls中:
packages:
pkg.installed:
- names:
{% include list_to_install %}
答案 0 :(得分:11)
你可以使用Pillar:
来做到这一点packages:
pkg:
- installed
- pkgs: {{ salt['pillar.get']('packages') }}
然后传递包含有效YAML的pillar
参数:
salt '*' state.sls package-list pillar='{packages: [foo, bar, baz]}'