Ex:
- name: Add lines
lineinfile: dest=/some/file line={{ item }}
with_items:
- "add a line"
- "another line"
- "and so on"
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.
--
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 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/8a411626-485a-478a-805a-bded06019e36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.