1. 主机规划

Saltstack_使用指南02_远程执行-验证-LMLPHP

2. Master与哪些minion通信

2.1. Master与哪些minion正常通信

 [root@salt100 ~]# salt '*' test.ping
salt100:
True
salt01:
True
salt02:
True
salt03:
True

2.2. 查看master与指定minion通信是否正常

比如指定salt01

 [root@salt100 ~]# salt 'salt01' test.ping
salt01:
True

3. 远程执行

示例1

 [root@salt100 ~]# salt '*' cmd.run 'w'
salt01:
:: up :, user, load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
yun pts/ 10.0.0.1 : :19m .27s .09s sshd: yun [priv]
salt100:
:: up :, user, load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
yun pts/ 10.0.0.1 : .00s .67s .03s sshd: yun [priv]
salt03:
:: up :, user, load average: 0.00, 0.01, 0.04
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
yun pts/ 10.0.0.1 : : .20s .03s sshd: yun [priv]
salt02:
:: up :, user, load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
yun pts/ 10.0.0.1 : :23m .25s .09s sshd: yun [priv]

示例2

 [root@salt100 ~]# salt '*' cmd.run 'mkdir -p /tmp/zhang'
salt03:
salt02:
salt100:
salt01:
[root@salt100 ~]# salt '*' cmd.run 'ls -ld /tmp/zhang'
salt100:
drwxr-xr-x root root Dec : /tmp/zhang
salt01:
drwxr-xr-x root root Dec : /tmp/zhang
salt02:
drwxr-xr-x root root Dec : /tmp/zhang
salt03:
drwxr-xr-x root root Dec : /tmp/zhang

4. saltstack与zeromq

 [root@salt100 ~]#  ps -ef | grep 'salt-ma'
root : ? :: /usr/bin/python /usr/bin/salt-master
root : ? :: /usr/bin/python /usr/bin/salt-master
root : ? :: /usr/bin/python /usr/bin/salt-master
root : ? :: /usr/bin/python /usr/bin/salt-master
root : ? :: /usr/bin/python /usr/bin/salt-master
root : ? :: /usr/bin/python /usr/bin/salt-master
root : ? :: /usr/bin/python /usr/bin/salt-master
root : ? :: /usr/bin/python /usr/bin/salt-master
root : ? :: /usr/bin/python /usr/bin/salt-master
root : ? :: /usr/bin/python /usr/bin/salt-master
root : ? :: /usr/bin/python /usr/bin/salt-master
root : ? :: /usr/bin/python /usr/bin/salt-master
root : ? :: /usr/bin/python /usr/bin/salt-master
root : pts/ :: grep --color=auto salt-ma
[root@salt100 ~]# yum install -y python-setproctitle
[root@salt100 ~]# systemctl restart salt-master.service # 重启 master
[root@salt100 ~]# ps -ef | grep 'salt-ma'
root : ? :: /usr/bin/python /usr/bin/salt-master ProcessManager
root : ? :: /usr/bin/python /usr/bin/salt-master MultiprocessingLoggingQueue
root : ? :: /usr/bin/python /usr/bin/salt-master ZeroMQPubServerChannel # ZeroMQ
root : ? :: /usr/bin/python /usr/bin/salt-master EventPublisher
root : ? :: /usr/bin/python /usr/bin/salt-master Maintenance
root : ? :: /usr/bin/python /usr/bin/salt-master ReqServer_ProcessManager
root : ? :: /usr/bin/python /usr/bin/salt-master MWorkerQueue
root : ? :: /usr/bin/python /usr/bin/salt-master MWorker-
root : ? :: /usr/bin/python /usr/bin/salt-master MWorker-
root : ? :: /usr/bin/python /usr/bin/salt-master MWorker-
root : ? :: /usr/bin/python /usr/bin/salt-master MWorker-
root : ? :: /usr/bin/python /usr/bin/salt-master FileserverUpdate
root : ? :: /usr/bin/python /usr/bin/salt-master MWorker-
root : ? :: /usr/bin/python /usr/bin/salt-master MWorker-
root : pts/ :: grep --color=auto salt-ma
root : ? :: /usr/bin/python /usr/bin/salt-master MWorker-
05-11 11:28