Thank you, but i need to copy each time one host

Example: 

- First execution of playbook : copy host1

- second execution of playbook : copy host2 


Thank you
Le vendredi 27 novembre 2020 à 07:25:33 UTC+1, [email protected] a écrit :

> 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/ae0a43fe-c56f-46e4-84f4-b33ad4bc122bn%40googlegroups.com.

Reply via email to