On Thu, 26 Nov 2020 20:58:48 -0800 (PST)
blue fox <[email protected]> wrote:

> I would to copy each time running playbook each host in file.txt

Is this what you're looking for ?

    - shell: "echo {{ item }} >> file.txt"
      loop: "{{ ansible_play_hosts_all }}"
      run_once: true
      delegate_to: localhost

FWIW, you can improve the log by prepending the date

    - block:
        - command: date
          register: result
        - shell: "echo {{ result.stdout}} {{ item }} >> file.txt"
          loop: "{{ ansible_play_hosts_all }}"
      run_once: true
      delegate_to: localhost

-- 
Vladimir Botka

-- 
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/20201127072505.650934ad%40gmail.com.

Attachment: pgp8eFwML1yaL.pgp
Description: OpenPGP digital signature

Reply via email to