# Concatenated Commands Not Executing

**URL:** <https://forum.ansible.com/t/concatenated-commands-not-executing/20037>\
**Category:** Ansible Project\
**Created:** [December 16, 2015, 9:19pm UTC](https://forum.ansible.com/t/concatenated-commands-not-executing/20037 "2015-12-16T21:19:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Colin\_Byrne](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@Colin\_Byrne](https://forum.ansible.com/u/Colin_Byrne)\
**Post date:** [December 16, 2015, 9:19pm UTC](https://forum.ansible.com/t/concatenated-commands-not-executing/20037/1 "2015-12-16T21:19:04Z")

</div>

Hey so I am still getting familiar with Ansible so apologies if this is amateur stuff:

I have an array of servers which I need to execute a series of commands on. I enter:  
`ansible all -m command -a "sudo apt-get -y update && sudo apt-get -y dist-upgrade && sudo apt-get -y autoclean && sudo apt-get -y autoremove"`

On all of the (remotely identical) servers I get the output:  
`  
server-name | FAILED | rc=100 \>\>

E: The update command takes no arguments

`

It of course seems that ansible can’t handle the concatated commands. Is this correct? Is there a workaround?

Thanks for any help

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [December 16, 2015, 9:25pm UTC](https://forum.ansible.com/t/concatenated-commands-not-executing/20037/2 "2015-12-16T21:25:50Z")

</div>

Use shell module instead

---

<div class="post-metadata">

**Author:** ![Colin\_Byrne](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@Colin\_Byrne](https://forum.ansible.com/u/Colin_Byrne)\
**Post date:** [December 17, 2015, 3:19am UTC](https://forum.ansible.com/t/concatenated-commands-not-executing/20037/3 "2015-12-17T03:19:18Z")

</div>

Thanks! worked great.
