fatbox/salt — comment on commit e640764e2173335fcf6970b3f98e836ab737e1b3
File:  line 0
By fatbox:

Agree, they both do sound fragile. Also limit being used doesn't stop the behaviour, the following will apply the edit on every state run.

/etc/nsswitch.conf:
file:
- sed
- limit: "^passwd:"
- before: "passwd:.*"
- after: "passwd:\tfiles"

While `file.substitute` sounds good I still think adding a new option to `sed` is the easiest and most straight forward. In my mind the option should indicate that `after` should be matched before `before`, and it should default to False.