ubuntu 17.04

master --------------syndic --------------------minion1
--------------------------- | --------------------minion2(syndic下的minion)
master
root@jy-KVM1:/etc/salt/base# cat /etc/salt/master
ipv6: False
interface: 192.168.90.177
auto_accept: True
state_top: top.sls
order_masters: True
return: mysql
file_roots: #如果想用runner。就必须在master端定义file_roots,并且sls文件要和syndic一样,都要有,这与单纯的集群执行highstate不一样。
base:

  • /etc/salt/base
    prod:
  • /etc/salt/prod

syndic
root@jy-KVM2:/etc/salt/base# cat /etc/salt/master|grep -v "#" |grep -v "^ *$"
ipv6: False
auto_accept: True
file_roots:
base:

  • /etc/salt/base
    prod:
  • /etc/salt/prod
    syndic_master: 192.168.90.177

minion1
root@jy-KVM3:~# cat /etc/salt/minion |grep -v "#" |grep -v "^ *$"
master: 192.168.90.178
id: 192.168.90.179
mysql.host: '192.168.90.177'
mysql.user: 'salt'
mysql.pass: 'salt'
mysql.db: 'salt'
mysql.port: 3306

minion2
root@jy-KVM4:~# cat /etc/salt/minion|grep -v "#" |grep -v "^ *$"
master: 192.168.90.178
id: 192.168.90.185
mysql.host: '192.168.90.177'
mysql.user: 'salt'
mysql.pass: 'salt'
mysql.db: 'salt'
mysql.port: 3306

在syndic端编写sls文件
root@jy-KVM2:/etc/salt/base# tree
.
├── runner.sls
├── his
│ ├── history.sls
│ └── init_env.sls
├── init
│ ├── dns.sls
│ ├── env_init.sls
│ └── files
│ └── resolv.conf
└── top.sls

在master执行 (重点)
#salt-run state.orchestrate runner test=Ture
#salt-run state.orchestrate runner

并没有数据返回给mysql