# shell module failing for grep

**URL:** <https://forum.ansible.com/t/shell-module-failing-for-grep/32298>\
**Category:** Ansible Project\
**Created:** [February 21, 2020, 8:31pm UTC](https://forum.ansible.com/t/shell-module-failing-for-grep/32298 "2020-02-21T20:31:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mzagrabe](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@mzagrabe](https://forum.ansible.com/u/mzagrabe)\
**Post date:** [February 21, 2020, 8:31pm UTC](https://forum.ansible.com/t/shell-module-failing-for-grep/32298/1 "2020-02-21T20:31:37Z")

</div>

Greetings,

I'm running ansible 2.9 (2.9.4+dfsg-1) and I've searched the mailing  
list archives regarding this issue, but I haven't found out why I'm  
seeing what I am seeing.

shell module is failing when I'm not expecting it to.

I run this command manually on my system:

$ dconf dump /org/mate/desktop/keybindings/ | grep "action='chromium'"  
action='chromium'

but in ansible:

- name: get dconf desktop/keybindings for chromium  
&nbsp;&nbsp;shell: dconf dump /org/mate/desktop/keybindings/ | grep "action='chromium'"  
&nbsp;&nbsp;register: dconf\_desktop\_keybindings  
&nbsp;&nbsp;ignore\_errors: True

and the output:

fatal: [zipper]: FAILED! =\> {"changed": true, "cmd": "dconf dump  
/org/mate/desktop/keybindings/ | grep \"action='chromium'\"", "delta":  
"0:00:00.005304", "end": "2020-02-21 14:24:31.441719", "msg":  
"non-zero return code", "rc": 1, "start": "2020-02-21 14  
:24:31.436415", "stderr": "", "stderr\_lines": , "stdout": "",  
"stdout\_lines": }

Any ideas why it is failing?

Thanks for any help!

-m

---

<div class="post-metadata">

**Author:** ![mzagrabe](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@mzagrabe](https://forum.ansible.com/u/mzagrabe)\
**Post date:** [February 21, 2020, 8:39pm UTC](https://forum.ansible.com/t/shell-module-failing-for-grep/32298/2 "2020-02-21T20:39:02Z")

</div>

SOLVED.

Ansible is using the root account, but dconf is using my user account.

Sorry for the noise!

-m

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [February 22, 2020, 9:02am UTC](https://forum.ansible.com/t/shell-module-failing-for-grep/32298/3 "2020-02-22T09:02:59Z")

</div>

Hi,

Did you submit the shell command with the same user ?

Regards,

---

<div class="post-metadata">

**Author:** ![mzagrabe](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@mzagrabe](https://forum.ansible.com/u/mzagrabe)\
**Post date:** [February 22, 2020, 6:20pm UTC](https://forum.ansible.com/t/shell-module-failing-for-grep/32298/4 "2020-02-22T18:20:30Z")

</div>

Thanks for the reply!

You are correct. It was the user that I ran the command as that was the issue.

For solving it, instead of:

become: yes  
become\_user: foo

I opted for:

su - foo -c

because it was a single point of entry for ansible into the target  
system. That is the root account.

Thanks for the help!

-m
