在salt的主配置/etc/salt/master
中有一个例子:
# The file server works on environments passed to the master, each environment
# can have multiple root directories, the subdirectories in the multiple file
# roots cannot match, otherwise the downloaded files will not be able to be
# reliably ensured. A base environment is required to house the top file.
# Example:
# file_roots:
# base:
# - /srv/salt/
# dev:
# - /srv/salt/dev/services
# - /srv/salt/dev/states
# prod:
# - /srv/salt/prod/services
# - /srv/salt/prod/states
file_roots 配置salt配置的存放目录, 其中base环境是必要的, 指定top.sls存放的位置.
每一个环境都可以定义多个目录, 优先级关系由定义目录的顺序决定.
file_roots: base: - /srv/salt/foo - /srv/salt/bar
如果寻找 salt://file.sls, 如果都存在/srv/salt/foo/file.sls和/srv/salt/bar/file.sls, 则使用第一个找到的.
废话不多说请看实例:
来源:CSDN
作者:knight-zhou
链接:https://blog.csdn.net/knight_zhou/article/details/103756066