It looks like you want to make sure a number of hosts can consistently
resolve each other's names.
But I don't understand the problem you have. The file can just be the
same (hence it's consistent)?
Either way, what is your source of truth?
Start from there, for instance with a template.
On Mon, 14 Sep 2020 at 17:37, vi1...@gmail.com <vi1...@gmail.com> wrote:
>
> Hi,
>
> Id like to ask for help to solve the following case, as I don't know how to solve it myself.
> Imagine that you have to replicate "/etc/hosts" file of the control node and spread it to specific managed nodes, via J2 template.
> "/etc/hosts" example:
> ------------------------
> 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
> ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
> 10.0.1.70 node1
> 10.0.1.80 node2
> 10.0.1.90 node3
> 10.0.1.60 node4
> ---------------------------
>
> In this case, you count on a .J2 template with the header within, and you have to set the file (using of course Ansible facts) and spread it to the NODES 1 and 2.
> J2 template in control node:
> ------------------------
> 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
> ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
> ------------------------
>
> How would you do that?
>
> I've been thinking long time about this problem with no success ... I am avoiding the following options, as I don't think they are the best way to perform the task (as J2 template is not used as a real template):
> - copy_paste of the hosts file content to J2 template, then spread
> - 4 plays, one for each node - delegate facts to localhost - write into the J2 in localhost - spread the template in a last 5th play to nodes 1 and 2
>
> Thank you so much in advance!!!! Really appreciate your help here!
>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4096be9a-9102-4994-8cff-23d276a6c8f2n%40googlegroups.com.
--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwPveicwo8UfJSSBiqGSROsZ3SQYBkmxDHSom5z5Go1J0Q%40mail.gmail.com.
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwMScupTWFTwojYYd9wP1%3DHx7HqKZL6d8%3Dat4eBYDGWWqg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d8f7487a-66a5-30e1-c402-2a9309ab83f6%40ufz.de.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3e64e689-aadd-cea0-72a4-cb4d1c688dc1%40linuxia.de.
A dictionary/map with all the hosts in inventory and variables assigned to them
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/463de94d-f451-f149-fc98-ba8324000670%40linuxia.de.