0

I would like to do a passwordless SSH login to another Linux server, and I would like to do the setup using ansible

Could you please advise why

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

are different ?

Here is the task used as an example:

- 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
nskalis
  • 147
  • 1
  • 4
  • 10

1 Answers1

2

ansible_ssh_host_key_rsa_public is a host key from /etc/ssh/ssh_host_rsa_key.pub file on remote host.

~/.ssh/id_rsa.pub is a public key of your local user account.

Konstantin Suvorov
  • 3,996
  • 1
  • 12
  • 13