If I'm not mistaken, we can print out debug (stdout/stderr) logs of bash after task is done in Ansible.
hello-world.sh
ping -c 5 www.google.com
my-playbook.yml
tasks:
- block:
- name: Print out hello world
command: "./hello-world.sh"
register: result
- debug: var=result.stdout_lines
- name: Print script execution result
ansible.builtin.debug:
var: result
verbosity: 4
Regarding above, ping results will be printed out after 5 times reach. That's why I'm curious to know how to print out each ping result while task is running in Ansible instead of task completed.