Taking, e.g., the following simple playbook:

---

- hosts: all
  gather_facts: false
  serial: 1

  tasks:
    - name: system date
      command: date
      register: date_out

    - name: print system date
      debug:
        msg: "Hostname is: {{ inventory_hostname }} and System date is: {{ 
date_out.stdout_lines[0] }}"

Rather than the msg output is interspersed thoughout, I'd like to aggregate 
all of the debug messages from the various hosts into consecutive lines, 
like this:

ok: [host1] => (item=Thu Sep 16 12:41:03 EDT 2021) => {
    "msg": "Hostname is: host1 and System date is: Thu Sep 16 12:41:03 EDT 
2021"
}
ok: [host2] => (item=Thu Sep 16 12:41:03 EDT 2021) => {
    "msg": "Hostname is: host2 and System date is: Thu Sep 16 12:41:03 EDT 
2021"
}

I hope I'm clear on my ask.  Is this possible and, if so, how do I do it?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/94bcf81a-7dae-4676-abb0-9be7b9563cf3n%40googlegroups.com.

Reply via email to