overwriting list variables in systemd dropin files
One thing I'm quite enjoying about sysadmining in the late-early 21st
century is systemd, and one thing in particular I like is it's
ubiquitous use of a single, simple, key value config file format (it's
just a shame it is Windows INI files). They're super easy to edit and
in most cases you don't even need to do that, since you can just use a
drop-in
file
to override single keys.
I'd added a drop-in as part of an unbound Ansible role that was
meant to override the DNS= key for the system-level bit of the
config, but it never seemed to work right - 127.0.0.1 was always
appended, never replacing the config. It occurred to me today that
perhaps it's a list, and if it was, there would have to be special
semantics for overriding the whole list, since the overrides are
also just INI files, so can only set keys, and that's used for
appending.
And lo, it is so, I should have been doing this in my drop-in file:
[Resolve]
# This resets the list so the line after can work - otherwise it appends
DNS=
DNS=127.0.0.1