{"action":"opened","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3332","repository_url":"https://api.github.com/repos/ansible/ansible-modules-core","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3332/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3332/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3332/events","html_url":"https://github.com/ansible/ansible-modules-core/issues/3332","id":143938143,"number":3332,"title":"Raw module adds substring \"/bin/sh -c\" to ssh remote command argument.","user":{"login":"artgromov","id":14799573,"avatar_url":"https://avatars.githubusercontent.com/u/14799573?v=3","gravatar_id":"","url":"https://api.github.com/users/artgromov","html_url":"https://github.com/artgromov","followers_url":"https://api.github.com/users/artgromov/followers","following_url":"https://api.github.com/users/artgromov/following{/other_user}","gists_url":"https://api.github.com/users/artgromov/gists{/gist_id}","starred_url":"https://api.github.com/users/artgromov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artgromov/subscriptions","organizations_url":"https://api.github.com/users/artgromov/orgs","repos_url":"https://api.github.com/users/artgromov/repos","events_url":"https://api.github.com/users/artgromov/events{/privacy}","received_events_url":"https://api.github.com/users/artgromov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-28T09:37:44Z","updated_at":"2016-03-28T09:37:44Z","closed_at":null,"body":"##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\nRaw module\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.1.0 (devel ab51384af1) last updated 2016/03/28 09:00:04 (GMT +300)\r\n  lib/ansible/modules/core: (detached HEAD 0268864211) last updated 2016/03/26 09:00:09 (GMT +300)\r\n  lib/ansible/modules/extras: (detached HEAD 6978984244) last updated 2016/03/26 09:00:09 (GMT +300)\r\n  config file = /home/admin/lab/ansible.cfg\r\n  configured module search path = Default w/o overrides\r\n```\r\n##### CONFIGURATION\r\n[defaults]\r\ninventory      = hosts.cfg\r\nforks          = 50\r\nforce_color = 1\r\nhost_key_checking = False\r\ncommand_warnings = True\r\nnocolor = 0\r\n\r\n##### OS / ENVIRONMENT\r\nRunning Ansible from:\r\nLinux 4.3.4-200.fc22.x86_64 #1 SMP Mon Jan 25 13:37:15 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux (Fedora release 22)\r\n\r\nManaging: N/A (set of diffferent Cisco devices)\r\n\r\n##### SUMMARY\r\nRaw module doesn't run remote commands on boxes without \"/bin/sh\" via ssh.\r\n\r\n##### STEPS TO REPRODUCE\r\n1. Get any devcie (cisco ios for example) with configured ssh access from management host.\r\n2. Add it to inventory:\r\n```\r\n[net]\r\nr1 ansible_host=10.1.10.21 \r\n```\r\n3. Run command: ansible r1 -m raw -a 'show version' -k\r\n```\r\n[admin@ansible lab]$ ansible r1 -m raw -a 'show version' -k\r\nSSH password: \r\nr1 | SUCCESS | rc=0 >>\r\n\r\nLine has invalid autocommand \"/bin/sh -c 'show version'\"Connection to 10.1.10.21 closed by remote host.\r\n```\r\n\r\n##### EXPECTED RESULTS\r\nThe output should contain the result of remote command execution like the following:\r\n```\r\n[admin@ansible lab]$ ssh admin@10.1.10.21 \"show version\"\r\nPassword: \r\nCisco IOS XE Software, Version 03.12.00.S - Standard Support Release\r\nCisco IOS Software, CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 15.4(2)S, RELEASE SOFTWARE (fc2)\r\n...\r\n< truncated > \r\n...\r\nConnection to 10.1.10.21 closed by remote host.\r\n```\r\n\r\n##### ACTUAL RESULTS\r\nRaw module adds substring \"/bin/sh -c\" to ssh remote command argument.\r\n```\r\n[admin@ansible lab]$ ansible r1 -m raw -a 'show version' -k -vvv\r\nUsing /home/admin/lab/ansible.cfg as config file\r\nSSH password: \r\n<10.1.10.21> ESTABLISH SSH CONNECTION FOR USER: None\r\n<10.1.10.21> SSH: EXEC sshpass -d12 ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o ConnectTimeout=10 -o ControlPath=/home/admin/.ansible/cp/ansible-ssh-%h-%p-%r -tt 10.1.10.21 '/bin/sh -c '\"'\"'show version'\"'\"''\r\nr1 | SUCCESS | rc=0 >>\r\n\r\nLine has invalid autocommand \"/bin/sh -c 'show version'\"Connection to 10.1.10.21 closed by remote host.\r\n```"}}