Friday, November 22, 2024

Bizarre Ansible (and SSH) behavior

I’m experiencing two weird behaviours, out of nowhere, without any intentional change on my part:

  1. Ansible (ansible all -i foo, -m ping) not only started to ask for the SSH key’s password, but also the key’s password is now (seemingly) incorrect. ❌

  2. the very same key password is deemed correct by SSH (ssh -F /path/to/my_ssh_config foo) but the password only works in case 1.:

    1. [✅ works] if typed relatively quickly;
    2. [❌ doesn’t work] if typed slowly, taking say a second between each key press;
    3. [❌ doesn’t work] if pasted.

Both Ansible and SSH prompt for the password with

Enter passphrase for key '/Users/foo/.ssh/bar':

(Ansible also adds ‘a white key’ Unicode grapheme after the :.)


  • ansible [core 2.17.1]
  • Python 3.11.5
  • OpenSSH_9.4p1, LibreSSL 3.3.6
  • macOS 14.3 (23D56)

Relevant files:

  • /path/to/my_ssh_config, for both 1. (Ansible) and 2. (SSH) above:
Host *
  StrictHostKeyChecking no
  User ec2-user
  IdentityFile /Users/foo/.ssh/bar
Host jump
  Hostname 34.1.1.1
Host foo
  ProxyJump jump
  Hostname 10.1.1.1
  • for 1. (Ansible) is below ansible.cfg, which is in the same directory from where the above Ansible command is run (ansible all):
[defaults]
host_key_checking = False
interpreter_python = auto
stdout_callback=community.general.yaml

[ssh_connection]
ssh_args = -F /path/to/my_ssh_config

Related Articles

Latest Articles