• Saltstack之SSH

安装

yum install -y salt-ssh

官方文档  https://docs.saltstack.com/en/latest/topics/ssh/index.html

 

配置

管理/etc/salt/roster文件,配置需要管理的所有主机

vi /etc/salt/roster
linux-node1.example.com:
  host: 192.168.137.11
  user: root
  port: 22
  
linux-node2.example.com:
  host: 192.168.137.12
  user: root
  port: 22

如何通过证书认证?

1)执行 salt-ssh '*' test.ping -i,提示输入密码;

2)用户输入一次密码后salt-ssh会将公钥发送到对应主机,例如:/root/.ssh/authorized_keys;

3)/etc/salt/pki/master/ssh目录下存master公钥和私钥。

备注:取消证书提示

vi /root/.ssh/config
StricHostKeyChecking no

 

命令

salt-ssh '*' -r 'df -h'  # -r参数直接执行Linux命令

 

使用场景

1、不使用minion,通过salt-ssh控制所有主机

2、minion升级、重启,通过salt-ssh可以实现

 

相关文章:

  • 2021-10-20
  • 2021-07-31
  • 2022-12-23
  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
猜你喜欢
  • 2021-12-14
  • 2021-08-24
  • 2021-07-08
  • 2018-06-30
  • 2021-08-22
  • 2022-12-23
  • 2021-06-04
相关资源
相似解决方案