I execute a shell script in remote hosts using ansible script module. My shell script test.sh is
pwd
echo "hello"
ls -l
My ansible playbook is
- name: Transfer and execute a script.
hosts: server
tasks:
- name: Copy and Execute the script
script: /root/test.sh
Besides, I want to view the execution result of every command in the script. But i only watched result.
changed: [172.18.96.134]
changed: [172.18.96.244]
changed: [172.18.96.245]
How can i watch result like this:
/root
hello
a.txt test.txt