Ansible: SSH Error: unix_listener: too long for Unix domain socket

Viewed 10922

This is a known issue and I found a solution but it's not working for me.

First I had:

fatal: [openshift-node-compute-e50xx] => SSH Error: ControlPath too long
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.

So I created a ~/.ansible.cfg. The content of it:

[ssh_connection]    
control_path=%(directory)s/%%h‐%%r

But after rerunning my ansible I stil have an error about 'too long'.

fatal: [openshift-master-32axx] => SSH Error: unix_listener: "/Users/myuser/.ansible/cp/ec2-xx-xx-xx-xx.eu-central-1.compute.amazonaws.com-centos.AAZFTHkT5xXXXXXX" too long for Unix domain socket
    while connecting to 52.xx.xx.xx:22
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.

Why is it still too long?

4 Answers

Just to add more, as the error shows this problem generally happens when the control path is too long for Unix domain socket, hence, to specific to ansible.

You can easily fix this by updating your config file to use the %C format instead of %r@%h:%p as follow:

$ mkdir ~/.ssh/control 
$ vim ~/.ssh/config 
Host *
  ControlPath ~/.ssh/control/%C
  ControlMaster auto

More Detail: man ssh_config defines the %C format as 'a hash of the concatenation: %l%h%p%r'. And refer here.

Related