1、准备基础环境
[root@linux-node1 base]# vim /etc/salt/master
file_roots:
base:
- /srv/salt/base
test:
- /srv/salt/test
prod:
- /srv/salt/prod
  #注:top.sls必须放在base环境下(即/srv/salt/base目录下)
  [root@linux-node1 base]# /etc/init.d/salt-master restart
  #重启Master配置生效
  [root@linux-node1 base]# mkdir /srv/salt/{base,test,prod} -p
  #创建目录
  [root@linux-node1 base]# cd /srv/salt/
  [root@linux-node1 base]# mv apache.sls top.sls base/
  [root@linux-node1 base]# cd /srv/salt/base/
  [root@linux-node1 base]# mkdir files
  [root@linux-node1 base]# cp /etc/resolv.conf /srv/salt/base/files/
  2、两种执行方法
  1)直接执行
  [root@linux-node1 base]#salt '*' state.sls dns
  2)通过top.sls执行高级状态
  [root@linux-node1 base]# vim /srv/salt/base/top.sls
  base:
  '*':
  - dns
  [root@linux-node1 base]# salt '*' state.highstate