I ran into the ‘unix_listener: “/home/my_name/.ansible/cp/ansible-ssh-vvvvvveerrrrryyyyy_looonnnngggggg_ssserrrveeerrr_nnnaaammmmeeeee.5GoIZEXF2gwQ7DF0” too long for Unix domain socket’ so I tried changing ControlPath to %(directory)s/ansible-ssh-%%r
Then all my remote commands started getting executed on localhost even though the logs indicated they were running on the target hosts. So I’m guessing ControlPath is the problem. yes?
If so, is there a more appropriate solution to this problem?
The controlpath uses %r, %h and %p to differentiate socket files for different hosts.
In particular %h is for the host name. I see you only have %r which is the remote username. By removing %h you will most definitely run into a situation where you are running commands on the wrong host, since it is using a control socket for the first host that is connected to.
You can use other paths instead of %(directory) or remove ansible-ssh- from the path for making it shorter.