As for your last suggestion - file -> file_line -> file_line - I understand you want to do some checking in each step. But, from Puppet's logic perspective, I think the result is the opposite of what you expect: if any test fails, Puppet will change the file to make the test pass; and, if the test passes, it doesn't apply the next resource(s). Because that's how resources work - you write the right state, and Puppet enforces it.