Issue 1:
ISSUE TYPE

Bug Report

ANSIBLE VERSION

ansible 2.0.2.0
config file =
configured module search path = Default w/o overrides

OS / ENVIRONMENT

Mac OSX El Capitan (10.11.3)

SUMMARY

This issue is strange. If I use the public DNS provided by AWS, Ansible fails to connect (see error report below). But if I use the IP address it can connect and everything works.

Just to make sure, I can ssh into it without issues (providing the same username and key file than ansible is using).

Output Error

No config file found; using defaults
Loaded callback default of type stdout, v2.0

PLAYBOOK: rmotr_admin-deploy.yml ***********************************************
1 plays in playbooks/rmotr_admin-deploy.yml

PLAY [rmotr-admin] *************************************************************

TASK [setup] *******************************************************************
<ec2-52-18-118-51.eu-west-1.compute.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ubuntu
<ec2-52-18-118-51.eu-west-1.compute.amazonaws.com> SSH: ansible.cfg set ssh_args: (-o)(ControlMaster=auto)(-o)(ControlPersist=60s)
<ec2-52-18-118-51.eu-west-1.compute.amazonaws.com> SSH: ANSIBLE_PRIVATE_KEY_FILE/private_key_file/ansible_ssh_private_key_file set: (-o)(IdentityFile="/Users/santiagobasulto/.ssh/rmotr.pem")
<ec2-52-18-118-51.eu-west-1.compute.amazonaws.com> SSH: ansible_password/ansible_ssh_pass not set: (-o)(KbdInteractiveAuthentication=no)(-o)(PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey)(-o)(PasswordAuthentication=no)
<ec2-52-18-118-51.eu-west-1.compute.amazonaws.com> SSH: ANSIBLE_REMOTE_USER/remote_user/ansible_user/user/-u set: (-o)(User=ubuntu)
<ec2-52-18-118-51.eu-west-1.compute.amazonaws.com> SSH: ANSIBLE_TIMEOUT/timeout set: (-o)(ConnectTimeout=10)
<ec2-52-18-118-51.eu-west-1.compute.amazonaws.com> SSH: PlayContext set ssh_common_args: ()
<ec2-52-18-118-51.eu-west-1.compute.amazonaws.com> SSH: PlayContext set ssh_extra_args: ()
<ec2-52-18-118-51.eu-west-1.compute.amazonaws.com> SSH: found only ControlPersist; added ControlPath: (-o)(ControlPath=/Users/santiagobasulto/.ansible/cp/ansible-ssh-%h-%p-%r)
<ec2-52-18-118-51.eu-west-1.compute.amazonaws.com> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile="/Users/santiagobasulto/.ssh/rmotr.pem"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 -o ControlPath=/Users/santiagobasulto/.ansible/cp/ansible-ssh-%h-%p-%r ec2-52-18-118-51.eu-west-1.compute.amazonaws.com '/bin/sh -c '"'"'( umask 22 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1461186869.5-5816100855549 `" && echo "` echo $HOME/.ansible/tmp/ansible-tmp-1461186869.5-5816100855549 `" )'"'"''
fatal: [ec2-52-18-118-51.eu-west-1.compute.amazonaws.com]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh.", "unreachable": true}
to retry, use: --limit @playbooks/rmotr_admin-deploy.retry

PLAY RECAP *********************************************************************
ec2-52-18-118-51.eu-west-1.compute.amazonaws.com : ok=0 changed=0 unreachable=1 failed=0

Issue 2:
ISSUE TYPE

Feature Idea

COMPONENT NAME

ssh control persist

ANSIBLE VERSION

2.0

SUMMARY

When trying to use the ec2 plugin, ssh fails with this error:

SSH Error: unix_listener: "/Users/luke/.ansible/cp/ansible-ssh-ec2-255-255-255-255.compute-1.amazonaws.com-22-ubuntu.CErvOvRE5U0urCgm" too long for Unix domain socket

Here's the full example:

$ ansible -vvvv -i ec2.py -u ubuntu us-east-1 -m ping
<ec2-255-255-255-255.compute-1.amazonaws.com> ESTABLISH CONNECTION FOR USER: ubuntu
<ec2-255-255-255-255.compute-1.amazonaws.com> REMOTE_MODULE ping
<ec2-255-255-255-255.compute-1.amazonaws.com> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/luke/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 ec2-255-255-255-255.compute-1.amazonaws.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1436458336.4-21039895766180 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1436458336.4-21039895766180 && echo $HOME/.ansible/tmp/ansible-tmp-1436458336.4-21039895766180'
ec2-255-255-255-255.compute-1.amazonaws.com | FAILED => SSH Error: unix_listener: "/Users/luke/.ansible/cp/ansible-ssh-ec2-255-255-255-255.compute-1.amazonaws.com-22-ubuntu.CErvOvRE5U0urCgm" too long for Unix domain socket
while connecting to 255.255.255.255:22
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.

I've changed some of the sensitive info in here like the IP etc.