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

Ahh. I see your point. Go ahead and revert, here is what I came up with based on your comment:

{% macro set_nsswitch(db, after) -%}
nsswitch_{{ db }}:
file:
- sed
- name: /etc/nsswitch.conf
- limit: '^{{ db }}:'
- before: '{{ db }}:.*'
- after: "{{ db }}:\t{{ after }}"
{%- endmacro %}

{{ set_nsswitch("passwd", "files") }}
{{ set_nsswitch("shadow", "files") }}
{{ set_nsswitch("group", "files") }}
{{ set_nsswitch("hosts", "files dns") }}

Limit really is the key. I guess I didn't fully grok the code before. :|