Ansible报错:“msg“: “Invalid/incorrect password: Permission denied, please try again.“

简介: Ansible报错:“msg“: “Invalid/incorrect password: Permission denied, please try again.“

错误


#Ansible管理端
[root@ansible ansible]# vim hosts
[dbservers]
 192.168.109.134 ansible_port=2222 ansible_user=root ansible_password=000000
#被控制端
[root@localhost ~]# cat /etc/ssh/sshd_config |grep Port
Port 2222
[root@ansible ansible]# ansible 192.168.109.134 -a 'date'
192.168.109.134 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Invalid/incorrect password: Permission denied, please try again.",
    "unreachable": true
}



提示报错,我很奇怪,以为是端口的问题,我又改成默认的22端口,还是一样的报错,报错信息说是密码问题,我仔细检查,密码就是000000没有问题,于是我去网上查了一下问题,得到了一个很令人匪夷所思的回答,说是密码的开头是0就会报错,于是我就去试验一下,改成123456后果然成功了。


成功


#Ansible端
[root@ansible ansible]# vim hosts
[lhq]
 192.168.109.134 ansible_port=2222 ansible_user=root ansible_password=123123
#被管理端
[root@localhost ~]# passwd
更改用户 root 的密码 。
新的 密码:
无效的密码: 密码少于 8 个字符
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
修改成123123
[root@ansible ansible]# ansible lhq -a 'date'
192.168.109.134 | CHANGED | rc=0 >>
2022年 07月 06日 星期三 16:16:13 CST



改完密码后果然成功了,难道真的是密码开头是0的原因么,我要再试验一下其他密码。


试验其他情况


因为131-133我之前做过密钥对验证,所以我先还原一下快照


#Ansible管理端
[root@ansible ansible]# vim hosts 
[webservers]
 192.168.109.131 ansible_user=root ansible_password=000000
 192.168.109.132 ansible_user=root ansible_password=012345
 192.168.109.133 ansible_user=root ansible_password=123123
 192.168.109.134 ansible_user=root ansible_password=101111
#再分别去各个主机上改密码
[root@ansible ansible]# ansible webservers -a 'date'
192.168.109.134 | CHANGED | rc=0 >>
2022年 07月 06日 星期三 16:55:01 CST
192.168.109.133 | CHANGED | rc=0 >>
2022年 07月 06日 星期三 16:55:01 CST
192.168.109.131 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Invalid/incorrect password: Permission denied, please try again.", 
    "unreachable": true
}
192.168.109.132 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Invalid/incorrect password: Permission denied, please try again.", 
    "unreachable": true
}
[root@ansible ansible]# ansible webservers -m ping -o
192.168.109.134 | SUCCESS => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "ping": "pong"}
192.168.109.133 | SUCCESS => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "ping": "pong"}
192.168.109.131 | UNREACHABLE!: Invalid/incorrect password: Permission denied, please try again.
192.168.109.132 | UNREACHABLE!: Invalid/incorrect password: Permission denied, please try again.


131和132机子出现问题,他们的密码是0开头


果然如网上那位兄弟所言,,0-9的数字里面只要开头取0的主机密码会产生本错误,其他数字都没问题。

目录
相关文章
|
缓存 Linux
yum安装ansible报错如何解决
本篇内容记录了yum安装ansible报错的解决方案。
1040 0
yum安装ansible报错如何解决
|
6月前
|
Shell API Docker
ansible api执行远程脚本结果中文乱码报错
ansible api执行远程脚本结果中文乱码报错
头疼:ansible坑之拷贝目录不报错,远程主机没有目录
头疼:ansible坑之拷贝目录不报错,远程主机没有目录
211 0
ansible安装后运行报错cryptography
[root@kazihuo ~]# ansible all -m ping ERROR! Unexpected Exception, this is probably a bug: (cryptography 0.
1409 0
|
Java 应用服务中间件 Shell
|
7月前
|
运维 Shell Linux
Ansible自动化运维工具之常用模块使用实战(5)
Ansible自动化运维工具之常用模块使用实战(5)
|
9月前
|
网络协议 网络安全
Ansible模块介绍——防火墙模块
Ansible模块介绍——防火墙模块
153 0
|
5天前
|
算法 安全 Linux
Ansible 中的copy 复制模块应用详解
Ansible 中的copy 复制模块应用详解