That may turn out to be too late depending on the complexity of the R.E. It's not an error-proof approach.
Il giorno martedì 13 febbraio 2018 16:48:53 UTC, Arthur Reyes ha scritto: > > You should run your playbook in check mode until you're certain that your > regular expression is precise. > > On Tuesday, February 13, 2018 at 10:45:57 AM UTC-6, Nico Sabbi wrote: >> >> HI, >> I need to do a grep-like search in a file without using shell commands >> and in a check_mode compatible way. >> I just need to check the presence of a given string a in a file without >> doing overwrites of any kind. >> I implemented something with lineinfile but I'm very annoyed by the need >> to specify the line parameter to overwrite the file >> because the r.e. may be wrong. >> >> Is there any cleaner way to do what I need? >> >> - name: grub >> become: true >> lineinfile: >> path: /etc/myfile >> backrefs: yes >> regexp: "^CMDLINE (.*)" >> line: 'CMDLINE \1' >> state: present >> register: myxx >> >> >> 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4dd755fe-ec09-4fe0-b404-e68cdcbb30eb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
