0
{
  "changed": false,
  "cmd": "/bin/git clone --bare ssh:********@enterprise.acme.net:7999/acme/acme-whm.git /usr/local/acme/.git",
  "msg": "Warning: Permanently added [enterprise.acme.net]:7999,[10.0.37.37]:7999 (RSA) to the list of known hosts.\r\nPermission denied (publickey).\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.",                                               
  "rc": 128,
  "stderr": "Warning: Permanently added [enterprise.acme.net]:7999,[10.0.37.37]:7999 (RSA) to the list of known hosts.\r\nPermission denied (publickey).\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n",                                          
  "stderr_lines": [
    "Warning: Permanently added [enterprise.acme.net]:7999,[10.0.37.37]:7999 (RSA) to the list of known hosts.",                                                                                                            
    "Permission denied (publickey).",
    "fatal: Could not read from remote repository.",
    "",
    "Please make sure you have the correct access rights",
    "and the repository exists."
  ],
  "stdout": "Cloning into bare repository /usr/local/acme/.git...\n",
  "stdout_lines": [
    "Cloning into bare repository /usr/local/acme/.git..."
  ]
}

Why would I be getting this problem if I have

accept_hostkey: True

In my play?

- name: Clone Git                                                                             
    environment:                                                                                
      TMPDIR: "{{ acme_root }}"                                                               
    git:                                                                                        
      bare: yes                                                                                 
      track_submodules: yes                                                                     
      accept_hostkey: yes                                                                       
      repo: "{{ acme_repo_upstream }}"                                                        
      dest: "{{ acme_root }}/.git"

1 Answer 1

0

Regardless of whether or not you can connect to Ansible and what your options are with Git if you see the following message,

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:J6ErF8jeZVKGsg0db5u2hiNeQbH4pdGzPcbpGXZhOm8.
Please contact your system administrator.
Add correct host key in /home/ecarroll/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/ecarroll/.ssh/known_hosts:50
  remove with:
  ssh-keygen -f "/home/ecarroll/.ssh/known_hosts" -R "10.1.38.15"
ECDSA host key for 10.1.38.15 has changed and you have requested strict checking.
Host key verification failed.

Then your agent will not forward. If you run ssh-add -l you'll see,

Could not open a connection to your authentication agent.

And, you'll have to run

 ssh-keygen -f "/home/ecarroll/.ssh/known_hosts" -R "10.1.38.15"

And then reconnect.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .