I have a scenario where the same config option appears several times in the same config file, only in different contexts. I'd like to run lineinfile to change the option, but it only performs one replace.
Would it be possible/desirable to add a thirsty option which performs more than one replace? Or is there some other way of changing this single option in multiple places that doesn't involve replacing the entire file or templating?
lineinfile is a bit of a challenge for many, so I’m somewhat hesistant to add more options to it. That being said, it would depend on the complexity of the patch, we could possibly consider it.
(It is usually much better to template the configuration file almost always unless you expect users to be modifying the file on their own as well – be declarative with what configurations you wish to push out and you’ll be certain of exactly what is there)
You may wish to invoke sed with the command module.