how to create a template jinja for copy hosts of static inventory

Le vendredi 27 novembre 2020 à 08:19:21 UTC+1, blue fox a écrit :

>
> 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/32d9f981-d9ce-48bb-802d-ed446c31021cn%40googlegroups.com.

Reply via email to