Quoting from *lineinfile* parameter *regexp* https://docs.ansible.com/ansible/latest/collections/ansible/builtin/lineinfile_module.html#parameter-regexp
For state=present, the pattern to replace if found. Only the last line found will be replaced. Thank you! On Fri, 6 May 2022 13:54:20 -0700 (PDT) Todd Lewis <[email protected]> wrote: > Assuming you only have one line for each version, it will assure > that the line for any version that's marked false will be > commented, and any line for a version marked true will be > uncommented. > Where it gets hairy is when you have more than one line for any > version. In that case, the second task only manages the first of ^^^^^ last > the lines for that version. That shouldn't happen, but you've > already seen that it does sometimes. When it does, you can run the > playbook with `force_remove_versions` set to true, and it will > remove all the matching lines - both good and bad - before the > second task puts the single entries back in the file, properly > commented or not as the case may be. -- Vladimir Botka -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/20220507053418.47953238%40gmail.com.
pgpCBCXinUTwZ.pgp
Description: OpenPGP digital signature
