ansible自动化运维排错思路

[root@jump121 ~]# ansible pssh -m command -a 'uptime'
192.168.80.121 | FAILED | rc=-1 >>
Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.  Please add this host's fingerprint to your known_hosts file to manage this host.
192.168.80.114 | FAILED | rc=-1 >>
Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.  Please add this host's fingerprint to your known_hosts file to manage this host.
192.168.80.111 | FAILED | rc=-1 >>
Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.  Please add this host's fingerprint to your known_hosts file to manage this host.
192.168.80.116 | CHANGED | rc=0 >>
 10:34:46 up  2:20,  3 users,  load average: 0.00, 0.00, 0.00

 

[root@jump121 ~]# ansible all -m ping
\192.168.80.111 | FAILED! => {
    "msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.  Please add this host's fingerprint to your known_hosts file to manage this host."
}
192.168.80.121 | FAILED! => {
    "msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.  Please add this host's fingerprint to your known_hosts file to manage this host."
}
192.168.80.114 | FAILED! => {
    "msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.  Please add this host's fingerprint to your known_hosts file to manage this host."
}
^H192.168.80.116 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "changed": false,
    "ping": "pong"
}

 

解决方法:

使用ansible之前要做密钥认证

[root@jump121 ~]# ssh root@192.168.80.111
The authenticity of host '192.168.80.111 (192.168.80.111)' can't be established.
ED25519 key fingerprint is SHA256:InW2EeyfSJq7zUz+oYR9GtIZJz+tAsGr2U28uYylapo.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.80.111' (ED25519) to the list of known hosts.
root@192.168.80.111's password: 
Last login: Thu Mar 28 10:57:29 2024 from 192.168.80.88
[root@jump111 ~]# 
注销
Connection to 192.168.80.111 closed.
 

[root@jump121 ~]# ssh root@192.168.80.114
The authenticity of host '192.168.80.114 (192.168.80.114)' can't be established.
ED25519 key fingerprint is SHA256:FqMSYQgufsI/RkpAPv+S4X3Y3rdWdqCYYwW4mOfn99M.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.80.114' (ED25519) to the list of known hosts.
root@192.168.80.114's password: 
Last login: Thu Mar 28 10:55:45 2024 from 192.168.80.88
[root@jump114 ~]# 
注销
Connection to 192.168.80.114 closed.
[root@jump121 ~]# ansible all -m ping

相关推荐

  1. Ansible自动化

    2024-04-01 06:04:01       48 阅读
  2. Ansible自动化

    2024-04-01 06:04:01       39 阅读
  3. Ansible自动化

    2024-04-01 06:04:01       38 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-01 06:04:01       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-01 06:04:01       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-01 06:04:01       87 阅读
  4. Python语言-面向对象

    2024-04-01 06:04:01       96 阅读

热门阅读

  1. 设计模式(11):适配器模式

    2024-04-01 06:04:01       44 阅读
  2. 2024.2.1力扣每日一题——数字游戏

    2024-04-01 06:04:01       35 阅读
  3. Vue企业级项目开发axios

    2024-04-01 06:04:01       44 阅读
  4. 微信小程序——小程序和页面生命周期详解

    2024-04-01 06:04:01       44 阅读
  5. npm 常用命令详解

    2024-04-01 06:04:01       39 阅读
  6. 【BlossomRPC】编解码器的实现

    2024-04-01 06:04:01       37 阅读
  7. 学习计划.

    2024-04-01 06:04:01       41 阅读
  8. 002 HTML元素

    2024-04-01 06:04:01       43 阅读