ansible批量验证密码

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:

 

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

posted @ 2018-08-31 20:58  开始认识  阅读(891)  评论(0编辑  收藏  举报