Calling lineinfile without any other arguments like my example would insert the lines at the end of the file if they don't already exist.
You can modify this behavior using insertbefore and insertafter, both take regex as a value, so you can determine certain sections to add the new lines to.. using maybe existing lines in the file or maybe placeholder comments? Backrefs are used to replace specific parts of an existing line using the regex + line values. On 1 Aug 2014 21:46, "John Oliver" <[email protected]> wrote: > If you just call lineinfile, where will it write them? At the end? What > if your target file has some kind of terminator, can you do a blanket > insertbefore or insertafter? I'm not really grokking the concept of > 'backrefs'. > > On Friday, August 1, 2014 11:33:36 AM UTC-7, Amr Ali wrote: >> >> You can use lineinfile and with_items >> >> Ex: >> >> - name: Add lines >> lineinfile: dest=/some/file line={{ item }} >> with_items: >> - "add a line" >> - "another line" >> - "and so on" >> >> -- > You received this message because you are subscribed to a topic in the > Google Groups "Ansible Project" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/ansible-project/45qZWxkte3A/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/8a411626-485a-478a-805a-bded06019e36%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/8a411626-485a-478a-805a-bded06019e36%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAEgsm8PVZien%3DaED_HYREN9XCHKcNzquCiQvZj00bQbVuDdOfw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
