Concatenated Commands Not Executing

24 views
Skip to first unread message

Colin Byrne

unread,
Dec 16, 2015, 4:19:04 PM12/16/15
to Ansible Project
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

Brian Coca

unread,
Dec 16, 2015, 4:25:58 PM12/16/15
to Ansible Project

Use shell module instead

Colin Byrne

unread,
Dec 16, 2015, 10:19:18 PM12/16/15
to Ansible Project
Thanks! worked great. 

On Wednesday, December 16, 2015 at 1:25:58 PM UTC-8, Brian Coca wrote:

Use shell module instead

Reply all
Reply to author
Forward
0 new messages