I need to add 10 lines to the middle of a file where the rest of the file is dynamic. Since it’s dynamic I need to use something like lineinfile. I’d rather not invoke lineinfile 10 times as that seems messy.
Suggestions?
I need to add 10 lines to the middle of a file where the rest of the file is dynamic. Since it’s dynamic I need to use something like lineinfile. I’d rather not invoke lineinfile 10 times as that seems messy.
Suggestions?
Why not use a template, or the assemble module? Both of those would seem to be a better fit.
Depending on the file, sometimes they support an include statement (e.g., sudoers, apparmor, mysql, apache, …) that you could assert lineinfile for then use template or file on the include file as appropriate.
–michael
Because an application is making changes to other parts of the file, and those changes need to be maintained. I can’t overwrite what the application is doing.
unfortunately, it’s not that kind of file. It’s a xml file for Oracle BI
on second thought, maybe I can do something like this in xml. I’ll take a look into that.