SaltStack之salt-ssh

SaltStack之salt-ssh

//安装salt-ssh
[root@localhost salt]#  yum -y install salt-ssh

//修改配置文件,添加受控机信息
[root@localhost salt]# vim /etc/salt/roster
[root@localhost salt]# cat /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.161.133
  user: root
  passwd: 123456
node2:
  host: 192.168.161.134
  user: root
  passwd: 123456



//ping一下
[root@localhost salt]# salt-ssh '*' test.ping
node1:
    ----------
    retcode:
        254
    stderr:
    stdout:
        The host key needs to be accepted, to auto accept run salt-ssh with the -i flag:
        The authenticity of host '192.168.161.133 (192.168.161.133)' can't be established.
        ECDSA key fingerprint is SHA256:yFImkxnTXlvrUi0ziMYzapAAGMHXpWmLKgX/klCoZ0s.
        ECDSA key fingerprint is MD5:fd:f7:a0:72:10:9d:1b:be:1e:8c:89:60:a0:1a:5e:7d.
        Are you sure you want to continue connecting (yes/no)? 
node2:
    ----------
    retcode:
        254
    stderr:
    stdout:
        The host key needs to be accepted, to auto accept run salt-ssh with the -i flag:
        The authenticity of host '192.168.161.134 (192.168.161.134)' can't be established.
        ECDSA key fingerprint is SHA256:BoRqxFUbuj4f0ICilMcfMoU9NW/SK4o/mxmqLokh680.
        ECDSA key fingerprint is MD5:58:0a:d0:66:84:ba:5a:a9:8c:28:24:c7:e8:e8:e4:5a.
        Are you sure you want to continue connecting (yes/no)? 
        
        
        
//第一次访问时需要输入 yes/no ,但是 saltstack是不支持交互式操作的,所以为了解决这个问题,我们需要对其进行设置,让系统不进行主机验证。     

[root@localhost salt]#  vim ~/.ssh/config
[root@localhost salt]# cat ~/.ssh/config
StrictHostKeyChecking no
[root@localhost salt]# salt-ssh '*' test.ping
node1:
    True
node2:
    True

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值