generate template once for group of hosts

24 views
Skip to first unread message

tomr

unread,
Dec 1, 2017, 11:53:16 PM12/1/17
to Ansible Project
My understanding is that ansible normally generates a file from a template once per host. Is it possible, when I know in advance that a file will be identical for all hosts in a group, to generate it only once?

Thanks,
tomr

Pshem Kowalczyk

unread,
Dec 2, 2017, 12:19:28 AM12/2/17
to ansible...@googlegroups.com
You can do the following (use two tasks instead of one 'template'):

1. Generate the template on the controller host (with delegate_to: localhost and run_once: true)
2. Copy the generated template to all the other hosts

kind regards
Pshem


--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/41cbe4a7-5c5c-4aec-aaaa-8bb702bef44a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages