There is a config file e.g. /etc/network/interfaces. I want to manage only a certain section of that file using Puppet.
# At the beginning at least is some dynamic content that can be different
# from machine to machine and changed by an admin manually
iface eth0 inet static
# BEGIN PUPPET WLAN0
iface wlan0 inet static
# END PUPPET WLAN0
# Potentially more stuff that I do not want to touch through Puppet
# But could be static if it makes it more easy. E.g. simply force sections to end of file.
The stdlib file_line resource is very close to what I need. A regex and content to replace a match with. However, unfortunately, there is no way to make file_line match over multiple lines and replace with new content.
Alternative 1: create a bash script: ugly Exec resources and temp files.
Alternaitve 2: Use Augeas: seems overkill for a simple search & replace.
Is there another module than stdlib that allows me to do a regex match & replace over multiple lines?
Any other handcraft solutions better than juggling temp bash script and Exec resource?