I want to run multiple commands in shell module, but i want to run 1st command on each hosts than move to next command on each host than third and so on, so that i can get output of same command together from all host at single place, tried with loop (with_item)
but no luck, need help
ansible by default runs a task on all hosts and then waits for result
from everyone before going to the next step. If your task has a loop,
there's no way to run the loop synchronously between all nodes,
because is a single task with multiple options.
You can split the commands in several shell tasks, instead one with a loop.
Thanks for the update, i’'ll try using multiple shell tasks, also can you please let me know how to make ansible not to print commands only print output of command
Hi how can i access array in shell module trying to access as below but not getting any output
tasks:
name: verify that it shows the new cluster ID for this company in active list and old cluster in inactive list
shell:
spaceorg=echo "{{ commaorg }}"|sed 's/,/ /g'|for i in ${spaceorg[@]} ; do echo $i ; /sc/bin/smmgr -s cid=$i -s getsminfo=company_ssn 2>/dev/null|grep $i|grep -v Changing ; done
args:
executable: /bin/bash
Hi how can i access array in shell module trying to access as below but not getting any output
tasks:
\- name: verify that it shows the new cluster ID for this company in active list and old cluster in inactive list
shell:
spaceorg=\`echo "\{\{ commaorg \}\}"|sed 's/,/ /g'\`|for i in $\{spaceorg\[@\]\} ; do echo $i ; /sc/bin/smmgr \-s cid=$i \-s