lineinfile able to change all occurrences of pattern?

15 views
Skip to first unread message

Ryan Groten

unread,
Sep 6, 2016, 12:13:29 PM9/6/16
to Ansible Project
If a regexp matches multiple lines in a file, lineinfile will only change the first occurrence.  Is there a way to make change them all?  I saw someone used another task to count the number of occurrences of a pattern and then loop using with_sequence in the lineinfile task but I'm wondering if there's a cleaner way.

Thanks,
Ryan
Reply all
Reply to author
Forward
0 new messages