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

 ansible配置文件写的密码为000000,root账号密码也真的是000000.

[root@m01 ~]# tail -3 /etc/ansible/hosts
[change]
192.168.200.5 ansible_user=root ansible_ssh_pass=000000
192.168.200.6 ansible_user=root ansible_ssh_pass=000000

可当执行下面语句时,一直报错显示密码不对

root@m01 ~]# ansible change -m command -a "hostname" 
192.168.200.5 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Invalid/incorrect password: Permission denied, please try again.", 
    "unreachable": true
}
192.168.200.6 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Invalid/incorrect password: Permission denied, please try again.", 
    "unreachable": true
}

结果发现是因为密码为00000的原因,开头不能为0,于是修改了要控制俩个机器的root账号

[root@rsnc01 ~]# passwd
更改用户 root 的密码 。
新的 密码:
无效的密码: 密码少于 8 个字符
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新

改成了123456.

接着把ansible的hosts文件中的密码也修改成123456

[root@m01 ~]# tail -3 /etc/ansible/hosts
[change]
192.168.200.5 ansible_user=root ansible_ssh_pass=123456
192.168.200.6 ansible_user=root ansible_ssh_pass=123456

再次运行发现成功,很神奇

[root@m01 ~]# ansible change -m command -a "hostname"  
192.168.200.5 | CHANGED | rc=0 >>
rsnc01
192.168.200.6 | CHANGED | rc=0 >>
nfs01

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值