author: headsen chen

date: 2018-08-31  20:45:49

综合比较salt-ssh,ansible .sshpass等批量验证100台机器的密码,最好推荐用ansible,步骤如下:

1,安装ansible 

     yum -y install epel-release
     yum -y install ansible

2, 配置ansible的hosts文件 

   vim /etc/ansible/hosts  

    [group1]
    10.0.0.1
    10.0.0.2
    10.0.0.3
    10.0.0.4
    10.0.0.5
    ...

3,开始验证密码:

  ansible  new -m raw -a 'date' -k

SSH password:

ansible批量验证密码

 

4、ansible批量验证非root用户:

  ansible  group1 -u tom -m raw -a 'date' -k

SSH password:   <------  输入密码

 

5,  ansible 指定客户端的ip来访问

 ansible -k 192.168.* -m file -a "path=/tmp/' date +% F' state=directory mode=755"

其他常用模块:
-m copy

-m shell

相关文章:

  • 2021-10-08
  • 2022-12-23
  • 2021-10-03
  • 2022-12-23
  • 2022-01-29
  • 2022-12-23
  • 2022-01-16
  • 2021-05-22
猜你喜欢
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
  • 2021-06-19
相关资源
相似解决方案