What ideas do others have on Best Practice for using lineinfile? As a potential conversation starter, here's a couple of ideas that have recently gelled for me:
1) Use two rules: * First delete all versions of the line * Then add the finished version of the line. This makes the process more idempotent (which, granted lineinfile has inherent problems with....) For context, this idea gells around adding a mailrelay statement for postfix's main.cf. In my environment I have 4 different platforms with various ad-hoc maintenance (covering quite a few years). 2) Use a (trailing) comment header (i.e. a "here are our changes" line) and then append changes after this. Some more context here, I suspect lineinfile appeals to those of us who have an existing set of servers that we are incrementally bringing into line. The "correct" path is likely to use a template of a file, but that requires determining which of the (our various) distro's is the "correct" set of settings. For something like "use our mail relay" this is a fairly large hurdle. Thanks for any comments in advance :-) -- 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-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8f05add6-63bd-4803-9e7e-289ce07031a2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.