# Command line with pipes

**URL:** <https://forum.ansible.com/t/command-line-with-pipes/17403>\
**Category:** Ansible Project\
**Created:** [January 30, 2015, 3:09pm UTC](https://forum.ansible.com/t/command-line-with-pipes/17403 "2015-01-30T15:09:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roman\_Dolgov](https://avatars.discourse-cdn.com/v4/letter/r/a698b9/32.png) [@Roman\_Dolgov](https://forum.ansible.com/u/Roman_Dolgov)\
**Post date:** [January 30, 2015, 3:09pm UTC](https://forum.ansible.com/t/command-line-with-pipes/17403/1 "2015-01-30T15:09:53Z")

</div>

`  
tasks:

- name: get clusters names  
command: “ps axu | grep bin/post | egrep -o etc/postgresql/9.3/.\* | awk -F ‘/’ ‘{print $4}’”

`

That command doesn’t work in ansible-playbook, but works fine in shell, I got error about wrong arguments of ps tool.  
How I could use pipes with ansible command ?

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [January 31, 2015, 12:25am UTC](https://forum.ansible.com/t/command-line-with-pipes/17403/2 "2015-01-31T00:25:43Z")

</div>

You will need to use the shell module instead of command.
