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.80 node3 10.0.1.80 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4096be9a-9102-4994-8cff-23d276a6c8f2n%40googlegroups.com.
