[lug] Environment variable expansion in systemd service files
Zan Lynx
zlynx at acm.org
Mon Feb 27 09:59:49 MST 2017
On February 27, 2017 9:46:37 AM MST, Brennen Bearnes <bbearnes at gmail.com> wrote:
>On Sun, Feb 26, 2017 at 8:15 PM, Chris Riddoch <riddochc at gmail.com>
>wrote:
>
>> I've been trying to figure out how to accomplish something in systemd
>> service configuration files, I hope maybe someone else has tried to
>do
>> something similar before and recognizes this.
>>
>
>I suspect that you may need to do something like described here:
>
>https://coreos.com/os/docs/latest/using-environment-variables-in-systemd-units.html
>
>...and define a separate unit file to dynamically create something you
>can
>feed to EnvironmentFile.
>
>This seems silly, so hopefully someone will tell me I'm wrong.
When you consider how many ways there are to write unit file fragments you realize that variable processing wouldn't work. What order would it run in? So embrace the duplication or use the variable in an exec string, or write a generator unit to build an environment for you.
More information about the LUG
mailing list