Like the filter plugin? How might that look in a playbook?
On Tue, Jun 10, 2014 at 12:22 PM, eskhool <[email protected]> wrote: > Sorry to dig out an old post but Michael would an enhancement to the regex > plugin to do multi line be accepted? Seems like pretty useful functionality > and the re module in python has a find_iter for just the task... > > > > On Saturday, January 4, 2014 11:25:24 PM UTC+5:30, Philippe Eveque wrote: > >> another way not as optimal as using sed like proposed by Michael is >> to do it via 2 tasks. >> >> tasks 1: count the number of lines to replace (via shell module using and >> grep -E <regexp> | wc -l ) >> using register to remember the linecounted >> >> task 2: using lineinfile and with_sequence: linecounted >> >> one caveat is that with sequence does not accept a 0 count ( a potential >> future improvement ?) >> >> so just add 1 to the count (you do not care about doing it one more time) >> >> then you can run those 2 tasks multiples times >> >> works for me on grub.conf >> >> >> >> >> >> >> >> >> 2014/1/4 Michael DeHaan <[email protected]> >> >>> It seems you would just use the shell module and invoke sed. >>> >>> >>> >>> On Sat, Jan 4, 2014 at 1:04 AM, eskhool <[email protected]> wrote: >>> >>>> Hi, >>>> If we don't have the option to use templates as the file may vary >>>> across system, is there a way to find and replace multiple lines based on a >>>> regex...something like an option in lineinfile such as 'all'. What other >>>> mechanism can be recommended? Any reason to not have this option? And if >>>> contributed will such a change be accepted in ansible core? >>>> >>>> Thanks >>>> >>>> -- >>>> 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]. >>>> >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>> >>> >>> >>> -- >>> Michael DeHaan <[email protected]> >>> >>> CTO, AnsibleWorks, Inc. >>> http://www.ansibleworks.com/ >>> >>> -- >>> 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]. >>> >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> -- > 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/c42cc74a-15be-4e8a-b049-9801b0e1126e%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/c42cc74a-15be-4e8a-b049-9801b0e1126e%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/CA%2BnsWgzkA7xcfg17iKhTp3%2Bsu-PtB5gZcTa5SWvTOt_NP%2Beyvw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
