公共ssh id在id_rsa.pub上不同于ansible_ssh_host_key_rsa_public

我想做一个无密码的SSHlogin到另一台Linux服务器,我想做安装使用ansible

你能告诉我为什么

  1. ~/.ssh/id_rsa.pub
  2. hostvars[item]['ansible_ssh_host_key_rsa_public']

是不同的 ?

以下是作为例子的任务:

 - debug: msg="ssh-rsa {{ hostvars[item]['ansible_ssh_host_key_rsa_public'] }} {{ hostvars[item]['ansible_user_id'] }}@{{ hostvars[item]['ansible_hostname'] }}" with_items: "{{ groups.pmacct }}" when: inventory_hostname in groups.ipacc - meta: end_play 

ansible_ssh_host_key_rsa_public是来自远程主机上/etc/ssh/ssh_host_rsa_key.pub文件的主机密钥。

~/.ssh/id_rsa.pub是您本地用户帐户的公钥。