本文共 1422 字,大约阅读时间需要 4 分钟。
ubuntu 17.04
master --------------syndic --------------------minion1
--------------------------- | --------------------minion2(syndic下的minion)masterroot@jy-KVM1:/etc/salt/base# cat /etc/salt/master ipv6: Falseinterface: 192.168.90.177auto_accept: Truestate_top: top.slsorder_masters: Truereturn: mysqlfile_roots: #如果想用runner。就必须在master端定义file_roots,并且sls文件要和syndic一样,都要有,这与单纯的集群执行highstate不一样。base:syndic
root@jy-KVM2:/etc/salt/base# cat /etc/salt/master|grep -v "#" |grep -v "^ *$"ipv6: Falseauto_accept: Truefile_roots:base:minion1
root@jy-KVM3:~# cat /etc/salt/minion |grep -v "#" |grep -v "^ *$"master: 192.168.90.178id: 192.168.90.179mysql.host: '192.168.90.177'mysql.user: 'salt'mysql.pass: 'salt'mysql.db: 'salt'mysql.port: 3306minion2
root@jy-KVM4:~# cat /etc/salt/minion|grep -v "#" |grep -v "^ *$"master: 192.168.90.178id: 192.168.90.185mysql.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
转载于:https://blog.51cto.com/pankuo/2048667