> For the complete documentation index, see [llms.txt](https://huataihuang.gitbook.io/cloud-atlas-draft/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://huataihuang.gitbook.io/cloud-atlas-draft/devops/ansible/troubleshoot/host_authenticity.md).

# paramiko主机认证报错

在执行`ansible-playbook example.yml`时候，总是提示`paramiko: The authenticity of host 'XXXX' can't be established.`

```bash
paramiko: The authenticity of host '192.168.1.1' can't be established.
The ssh-rsa key fingerprint is eff0743134e86397485685c5c9d84b8e.
Are you sure you want to continue connecting (yes/no)?
```

比较奇怪的是，其实这台主机是可以ssh登录的，并且已经ssh可以正常登录（并没有提示需要确认主机key）：检查可以看到`/etc/ssh/ssh_config`配置了

```bash
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
```

所以`ssh HOST`时候不会报错（即不校验host key）。

但是`paramiko`是不使用`/etc/ssh_config`配置，导致ansible还是要校验host key。

参考 [Host Key Checking](http://docs.ansible.com/ansible/intro_getting_started.html#host-key-checking)，我们可以在 `/etc/ansible/ansible.cfg`或`~/.ansible.cfg`添加

```bash
[defaults]
host_key_checking = False
```

或

```bash
export ANSIBLE_HOST_KEY_CHECKING=False
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://huataihuang.gitbook.io/cloud-atlas-draft/devops/ansible/troubleshoot/host_authenticity.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
