ansible批量修改ubuntu系统的密码
ansible批量修改ubuntu系统的密码:注:
1、需提前配好免密码登录
2、密码里带特殊符号的需前加转义符,如:\$、\%、*、\&等
3、被操作端需安装python
apt-get install ansible
vi /etc/ansible/hosts
10.0.0.2
10.0.0.3
:wq
ansible ming -m shell -a 'echo root:xx\$0*xx\& | chpasswd'
改成功了会有下面提示:
10.0.0.2 | SUCCESS | rc=0 >>
附:
ansible批量修改redhat密码的命令:
ansible ming2 -m shell -a 'echo xx\$0*xx\& | passwd --stdin root'
页:
[1]