# salt-ssh systemctl stop salt-minion
1. yum install -y salt-ssh
2. vim /etc/salt/roster
# Sample salt-ssh config file
#web1:
# host: 192.168.42.1 # The IP addr or DNS hostname
# user: fred # Remote executions will be executed as user fred
# passwd: foobarbaz # The password to use for login, if omitted, keys are used
# sudo: True # Whether to sudo to root, not enabled by default
#web2:
# host: 192.168.42.2
node1:
host: 192.168.2.104
user: root
passwd: 19920308shibin
port: 22
node2:
host: 192.168.2.103
user: root
passwd: 19920308shibin
port: 22
3. salt-ssh '*' test.ping -i
4. salt-ssh '*' -r 'w'
# 执行效果如下:
#---------------------------------------------------------------------------
node2:
----------
retcode:
0
stderr:
stdout:
root@192.168.2.103's password:
01:09:20 up 2:20, 3 users, load average: 0.10, 0.16, 0.21
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty1 07:48 ? 0.38s 0.38s -bash
root pts/0 192.168.2.101 23:45 8.00s 0.74s 0.02s /usr/bin/python /usr/bin/salt-ssh * -r w
root pts/1 192.168.2.101 23:54 22:08 0.39s 0.39s -bash
node1:
----------
retcode:
0
stderr:
stdout:
root@192.168.2.104's password:
06:56:25 up 11:47, 3 users, load average: 0.00, 0.04, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty1 19:09 1:24m 2.27s 2.27s -bash
root pts/0 192.168.2.101 05:32 21:37 1.39s 1.39s -bash
root pts/1 192.168.2.101 05:42 55:21 1.09s 1.09s -bash
#---------------------------------------------------------------------------
SaltStack 八
原创
©著作权归作者所有:来自51CTO博客作者大宝天天用的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:SaltStack 十
下一篇:SaltStack 九
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
java 根据范型创建对象
如何根据字符串动态创建类对象 今天跟同事聊天的时候,同事有一个需求,就是如何根据类的名字和值,动态返回该类的实例对象。比如,我们给一个函数传入字符串类名”java.lang.String”和值“wuguowei”,则该函数则返回一个值为“wuguowei”的字符串对象。当然,我们也可以返回Integer对象、Long对象等,该
java 根据范型创建对象 constructor exception integer string