{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/17096","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/17096/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/17096/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/17096/events","html_url":"https://github.com/ansible/ansible/issues/17096","id":171292437,"number":17096,"title":"Ansible SSH Strange behavior ","user":{"login":"ramsrib","id":1449806,"avatar_url":"https://avatars.githubusercontent.com/u/1449806?v=3","gravatar_id":"","url":"https://api.github.com/users/ramsrib","html_url":"https://github.com/ramsrib","followers_url":"https://api.github.com/users/ramsrib/followers","following_url":"https://api.github.com/users/ramsrib/following{/other_user}","gists_url":"https://api.github.com/users/ramsrib/gists{/gist_id}","starred_url":"https://api.github.com/users/ramsrib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramsrib/subscriptions","organizations_url":"https://api.github.com/users/ramsrib/orgs","repos_url":"https://api.github.com/users/ramsrib/repos","events_url":"https://api.github.com/users/ramsrib/events{/privacy}","received_events_url":"https://api.github.com/users/ramsrib/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.1","name":"affects_2.1","color":"5319e7"},{"url":"https://api.github.com/repos/ansible/ansible/labels/bug_report","name":"bug_report","color":"fbca04"},{"url":"https://api.github.com/repos/ansible/ansible/labels/needs_info","name":"needs_info","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-08-16T00:14:20Z","updated_at":"2016-09-23T13:37:02Z","closed_at":null,"body":"\r\n##### ISSUE TYPE\r\n<!--- Pick one below and delete the rest: -->\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\nansible -m ping\r\nansible-playbook\r\n\r\n##### ANSIBLE VERSION\r\n```\r\n$ ansible --version\r\nansible 2.1.1.0\r\n  config file =\r\n  configured module search path = Default w/o overrides\r\n```\r\n\r\n##### CONFIGURATION\r\nI'm not using any custom ansible.cfg file and ansible related environment variables\r\n\r\n##### OS / ENVIRONMENT\r\nOS: Mac OS-X 10.11.6\r\n\r\n##### SUMMARY\r\n- When i try to run ansible commands, its failing with SSH unreachable error. Same ssh keys works fine with ssh command.\r\n- When i pass -k argument, it works (which is strange).\r\n\r\n\r\n##### STEPS TO REPRODUCE\r\n\r\n**$ ansible node4 -m ping -vvvvv -i .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory  -u centos --private-key=/tmp/sriram-key-pair-uswest2.pem**\r\n\r\n```\r\nNo config file found; using defaults\r\nLoaded callback minimal of type stdout, v2.0\r\n<ec2-54-244-27-202.us-west-2.compute.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: centos\r\n<ec2-54-244-27-202.us-west-2.compute.amazonaws.com> SSH: ansible.cfg set ssh_args: (-o)(ControlMaster=auto)(-o)(ControlPersist=60s)\r\n<ec2-54-244-27-202.us-west-2.compute.amazonaws.com> SSH: ANSIBLE_PRIVATE_KEY_FILE/private_key_file/ansible_ssh_private_key_file set: (-o)(IdentityFile=\"/tmp/sriram-key-pair-uswest2.pem\")\r\n<ec2-54-244-27-202.us-west-2.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)\r\n<ec2-54-244-27-202.us-west-2.compute.amazonaws.com> SSH: ANSIBLE_REMOTE_USER/remote_user/ansible_user/user/-u set: (-o)(User=centos)\r\n<ec2-54-244-27-202.us-west-2.compute.amazonaws.com> SSH: ANSIBLE_TIMEOUT/timeout set: (-o)(ConnectTimeout=10)\r\n<ec2-54-244-27-202.us-west-2.compute.amazonaws.com> SSH: PlayContext set ssh_common_args: ()\r\n<ec2-54-244-27-202.us-west-2.compute.amazonaws.com> SSH: PlayContext set ssh_extra_args: ()\r\n<ec2-54-244-27-202.us-west-2.compute.amazonaws.com> SSH: found only ControlPersist; added ControlPath: (-o)(ControlPath=/Users/sriram/.ansible/cp/ansible-ssh-%h-%p-%r)\r\n<ec2-54-244-27-202.us-west-2.compute.amazonaws.com> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile=\"/tmp/sriram-key-pair-uswest2.pem\"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=centos -o ConnectTimeout=10 -o ControlPath=/Users/sriram/.ansible/cp/ansible-ssh-%h-%p-%r ec2-54-244-27-202.us-west-2.compute.amazonaws.com '/bin/sh -c '\"'\"'( umask 77 && mkdir -p \"` echo $HOME/.ansible/tmp/ansible-tmp-1471305099.14-154152306093416 `\" && echo ansible-tmp-1471305099.14-154152306093416=\"` echo $HOME/.ansible/tmp/ansible-tmp-1471305099.14-154152306093416 `\" ) && sleep 0'\"'\"''\r\nnode4 | UNREACHABLE! => {\r\n    \"changed\": false,\r\n    \"msg\": \"Failed to connect to the host via ssh.\",\r\n    \"unreachable\": true\r\n}\r\n\r\n```\r\n\r\nI tried the same command with **-k** (ask ssh password) option and gave some **wrong** password, but  this time, its working fine. \r\n\r\nNote: Giving empty password also fails.\r\n\r\n\r\n$ **ansible node4 -m ping -vvvvv -i .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory  -u centos --private-key=/tmp/sriram-key-pair-uswest2.pem  -k**\r\n```\r\nNo config file found; using defaults\r\nSSH password:\r\nLoaded callback minimal of type stdout, v2.0\r\n<ec2-54-244-27-202.us-west-2.compute.amazonaws.com> ESTABLISH CONNECTION FOR USER: centos on PORT 22 TO ec2-54-244-27-202.us-west-2.compute.amazonaws.com\r\n<ec2-54-244-27-202.us-west-2.compute.amazonaws.com> EXEC /bin/sh -c '( umask 77 && mkdir -p \"` echo $HOME/.ansible/tmp/ansible-tmp-1471305394.91-85947902161858 `\" && echo ansible-tmp-1471305394.91-85947902161858=\"` echo $HOME/.ansible/tmp/ansible-tmp-1471305394.91-85947902161858 `\" ) && sleep 0'\r\n<ec2-54-244-27-202.us-west-2.compute.amazonaws.com> PUT /var/folders/y5/h3rdfzy16377pxk300q_73c8wlk8l2/T/tmplKmwMf TO /home/centos/.ansible/tmp/ansible-tmp-1471305394.91-85947902161858/ping\r\n<ec2-54-244-27-202.us-west-2.compute.amazonaws.com> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/centos/.ansible/tmp/ansible-tmp-1471305394.91-85947902161858/ping; rm -rf \"/home/centos/.ansible/tmp/ansible-tmp-1471305394.91-85947902161858/\" > /dev/null 2>&1 && sleep 0'\r\nnode4 | SUCCESS => {\r\n    \"changed\": false,\r\n    \"invocation\": {\r\n        \"module_args\": {\r\n            \"data\": null\r\n        },\r\n        \"module_name\": \"ping\"\r\n    },\r\n    \"ping\": \"pong\"\r\n}\r\n\r\n\r\n```\r\nIt looks like a bug related in ansible ssh authentication.\r\n\r\n\r\n\r\n\r\n\r\n##### EXPECTED RESULTS\r\nIt should be able to authenticate with the given private key.\r\n\r\n##### ACTUAL RESULTS\r\nIts failing with Unreachable error.\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/249195132","html_url":"https://github.com/ansible/ansible/issues/17096#issuecomment-249195132","issue_url":"https://api.github.com/repos/ansible/ansible/issues/17096","id":249195132,"user":{"login":"ki0","id":1217550,"avatar_url":"https://avatars.githubusercontent.com/u/1217550?v=3","gravatar_id":"","url":"https://api.github.com/users/ki0","html_url":"https://github.com/ki0","followers_url":"https://api.github.com/users/ki0/followers","following_url":"https://api.github.com/users/ki0/following{/other_user}","gists_url":"https://api.github.com/users/ki0/gists{/gist_id}","starred_url":"https://api.github.com/users/ki0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ki0/subscriptions","organizations_url":"https://api.github.com/users/ki0/orgs","repos_url":"https://api.github.com/users/ki0/repos","events_url":"https://api.github.com/users/ki0/events{/privacy}","received_events_url":"https://api.github.com/users/ki0/received_events","type":"User","site_admin":false},"created_at":"2016-09-23T13:37:02Z","updated_at":"2016-09-23T13:37:02Z","body":"I use @ramsrib versrion from OS and ansible, my openssh version is OpenSSH_6.9p1, LibreSSL 2.1.8. This is really strange, because i thought it was a configuration issue but after digging on it, i am not really sure.\r\n\r\n@jctanner what info do you need?\r\n\r\nCheers!!"}}
{"actor":{"display_login":"ki0"}}