# ansible 1.1 and sudo "msg": "Unmatched \\".\\r\\n",

**URL:** <https://forum.ansible.com/t/ansible-1-1-and-sudo-msg-unmatched-r-n/12784>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [May 9, 2013, 1:26pm UTC](https://forum.ansible.com/t/ansible-1-1-and-sudo-msg-unmatched-r-n/12784 "2013-05-09T13:26:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [May 9, 2013, 1:26pm UTC](https://forum.ansible.com/t/ansible-1-1-and-sudo-msg-unmatched-r-n/12784/1 "2013-05-09T13:26:48Z")

</div>

Are the guests you are managing also SLES?

Have you modified anything else in your ansible.cfg?

What transport are you using?

etc

---

<div class="post-metadata">

**Author:** ![jalyvr](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@jalyvr](https://forum.ansible.com/u/jalyvr)\
**Post date:** [May 10, 2013, 4:40am UTC](https://forum.ansible.com/t/ansible-1-1-and-sudo-msg-unmatched-r-n/12784/2 "2013-05-10T04:40:47Z")

</div>

Here is ansible.cfg  
[defaults]

hostfile = /export/home/jal/ansible/ansible\_hosts

module\_name = ping

remote\_tmp = $HOME/.ansible/tmp

pattern = \*

forks=5

timeout=10

poll\_interval=15

sudo\_user=root

transport=paramiko

remote\_port=22

sudo\_exe=sudo

ansible\_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:  
%S by {uid} on {host}

action\_plugins = /usr/share/ansible\_plugins/action\_plugins  
callback\_plugins = /usr/share/ansible\_plugins/callback\_plugins  
connection\_plugins = /usr/share/ansible\_plugins/connection\_plugins  
lookup\_plugins = /usr/share/ansible\_plugins/lookup\_plugins  
vars\_plugins = /usr/share/ansible\_plugins/vars\_plugins  
filter\_plugins = /usr/share/ansible\_plugins/filter\_plugins

[paramiko\_connection]

[ssh\_connection]

ssh\_args=-o PasswordAuthentication=no -o ControlMaster=auto -o  
ControlPersist=60s -o ControlPath=/tmp/ansible-ssh-%h-%p-%r

Here is some -vvv output where ping to xxx is to the same host I am  
running the command on. This machine is SLES11SP2 but others are SP1  
or SLES10 SP4.

% echo $SHELL  
/bin/csh

[py-env0] 324 xxx:/export/home/jal/ansible% ansible -vvv xxx --sudo  
\<xxx\> ESTABLISH CONNECTION FOR USER: jal on PORT 22 TO xxx  
\<xxx\> EXEC /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/  
ansible-1368160527.82-22673769589329 && chmod a+rx $HOME/.ansible/tmp/  
ansible-1368160527.82-22673769589329 && echo $HOME/.ansible/tmp/  
ansible-1368160527.82-22673769589329'  
\<xxx\> REMOTE\_MODULE ping  
\<xxx\> PUT /tmp/tmpnY4SrN TO /export/home/jal/.ansible/tmp/  
ansible-1368160527.82-22673769589329/ping  
\<xxx\> EXEC /bin/sh -c "sudo -k && sudo -H -S -p \"[sudo via ansible,  
key=dliauzrktkxngnjgqjrwicovipfkwgns] password: \" -u root /bin/sh -c  
' /usr/bin/python /export/home/jal/.ansible/tmp/  
ansible-1368160527.82-22673769589329/ping; rm -rf /export/home/  
jal/.ansible/tmp/ansible-1368160527.82-22673769589329/ \>/dev/null  
2\>&1'"  
xxx | FAILED \>\> {  
&nbsp;&nbsp;&nbsp;&nbsp;"failed": true,  
&nbsp;&nbsp;&nbsp;&nbsp;"msg": "Unmatched \".\r\n",  
&nbsp;&nbsp;&nbsp;&nbsp;"parsed": false  
}

[py-env0] 325 xxx:/export/home/jal/ansible% ansible -vvv xxx  
\<xxx\> ESTABLISH CONNECTION FOR USER: jal on PORT 22 TO xxx  
\<xxx\> EXEC /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/  
ansible-1368160534.52-212786638814322 && chmod a+rx $HOME/.ansible/tmp/  
ansible-1368160534.52-212786638814322 && echo $HOME/.ansible/tmp/  
ansible-1368160534.52-212786638814322'  
\<xxx\> REMOTE\_MODULE ping  
\<xxx\> PUT /tmp/tmpeeNv5x TO /export/home/jal/.ansible/tmp/  
ansible-1368160534.52-212786638814322/ping  
\<xxx\> EXEC /bin/sh -c ' /usr/bin/python /export/home/jal/.ansible/tmp/  
ansible-1368160534.52-212786638814322/ping; rm -rf /export/home/  
jal/.ansible/tmp/ansible-1368160534.52-212786638814322/ \>/dev/null  
2\>&1'  
xxx | success \>\> {  
&nbsp;&nbsp;&nbsp;&nbsp;"changed": false,  
&nbsp;&nbsp;&nbsp;&nbsp;"ping": "pong"  
}

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [May 10, 2013, 1:35pm UTC](https://forum.ansible.com/t/ansible-1-1-and-sudo-msg-unmatched-r-n/12784/3 "2013-05-10T13:35:51Z")

</div>

What version of ansible also?

Sounds like your JSON isn’t being parsed correctly, you may wish to debug on the remote host using the ./hacking/test-module script in the checkout.

I’m not sure why that would be.

---

<div class="post-metadata">

**Author:** ![jalyvr](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@jalyvr](https://forum.ansible.com/u/jalyvr)\
**Post date:** [May 12, 2013, 10:22pm UTC](https://forum.ansible.com/t/ansible-1-1-and-sudo-msg-unmatched-r-n/12784/4 "2013-05-12T22:22:30Z")

</div>

> Sounds like your JSON isn't being parsed correctly, you may wish to debug  
> on the remote host using the ./hacking/test-module script in the checkout.

The scripts (-vvv) seem to work when invoked manually on the remote  
node. The pattern /bin/sh -c ' list of commands here' doesn't work  
when passed via paramiko or ssh to sudo on the remote node. The  
result is a sudo error message, which not surprisingly does not parse  
as json, hence the error message I got.

Omitting the /bin/sh -c part at the front seems to work (manually) via  
ssh. I'm not sure why that is there, as lib/ansible/runner/  
connection\_plugins/ssh.py evidently has the option but it is never  
used, the parameter always being /bin/sh.

Ultimately the issue seems to be sudo, which I am continuing to  
explore.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [May 13, 2013, 12:08am UTC](https://forum.ansible.com/t/ansible-1-1-and-sudo-msg-unmatched-r-n/12784/5 "2013-05-13T00:08:26Z")

</div>

Perhaps a small amount of debugging could yield the sudo error message you are getting?

Haven’t heard this reported before, I’ll see tomorrow who else in channel has some SLES – think we would have heard this already…

Thanks!

---

<div class="post-metadata">

**Author:** ![jalyvr](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@jalyvr](https://forum.ansible.com/u/jalyvr)\
**Post date:** [May 22, 2013, 5:15am UTC](https://forum.ansible.com/t/ansible-1-1-and-sudo-msg-unmatched-r-n/12784/6 "2013-05-22T05:15:43Z")

</div>

Solved. My default shell is csh which is invoked everywhere (via NIS); the quoted string used for sudo is not properly handled by csh.

Switching my account to bash fixed it. Huh. Not that I care; i was always doing sh or bash manually anyways.

–John
