Hello there!

there was a request to enhance the lineinfile module so that it ensures 
that only one line matching the regexp is left in the file.
https://github.com/ansible/ansible/issues/30235

This issue was closed with the justification that the module "replace" does 
the job. However, neither the documentation of the replace module nor the 
comments closing the issue specify how one can use the module to remove all 
but one matched lines.

Can anyone explain how I could use the replace module to ensure that a file 
has only one line that matches the regex and not more?

If it is not possible to do that with the replace module (which is 
obviously not the same as modifying all the occurences of a match), then I 
guess that one should re-open the issue so that proper solution is 
discussed and provided (as issue is locked, it is not possible to further 
the discussion on the topic at the moment).

Kind regards,

Come

-- 
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/44a49c28-5a41-4d78-b068-294325841eben%40googlegroups.com.

Reply via email to