Set environment variable for Service resource

100 views
Skip to first unread message

Andrei Iacob

unread,
Nov 7, 2017, 2:27:39 PM11/7/17
to Puppet Users
Hello,
is there a way to configure a set of environment variables to be available to a Service resource similar to what Exec supports?

Looking at the documentation this doesn't seem to fit (except probably from the Manifest attribute but still can't figure out how) so is there a workaround for this such as exporting an environment variable globally? What I want to avoid doing is writing a bash script to export them and run it prior to the Service's actual start script.

Thanks!

Dirk Heinrichs

unread,
Nov 7, 2017, 2:31:14 PM11/7/17
to puppet...@googlegroups.com
Am 07.11.2017 um 02:10 schrieb Andrei Iacob:

is there a way to configure a set of environment variables to be available to a Service resource similar to what Exec supports?

Looking at the documentation this doesn't seem to fit (except probably from the Manifest attribute but still can't figure out how) so is there a workaround for this such as exporting an environment variable globally? What I want to avoid doing is writing a bash script to export them and run it prior to the Service's actual start script.

Which OS (flavour, version)?

Bye...

    Dirk
--
Dirk Heinrichs
Senior Systems Engineer, Delivery Pipeline
OpenTextTM Discovery | Recommind
Email: dirk.he...@recommind.com
Website: www.recommind.de

Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach

Vertretungsberechtigte Geschäftsführer John Marshall Doolittle, Gordon Davies, Roger Illing, Registergericht Amtsgericht Bonn, Registernummer HRB 10646

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.

Peter Faller

unread,
Nov 7, 2017, 3:24:24 PM11/7/17
to Puppet Users
In general, I'd say you would have to put the variables into a configuration file for the service (via a template, or an augeas resource), or if the service is managed by systemd, in the relevant '???.service' file.

Dirk Heinrichs

unread,
Nov 8, 2017, 7:05:59 AM11/8/17
to puppet...@googlegroups.com
Am 07.11.2017 um 16:24 schrieb Peter Faller:

or if the service is managed by systemd, in the relevant '???.service' file.

Or, if the service file is shipped as part of a distribution package, in a '*.conf' file in the corresponding '???.service.d' directory (to be created), to avoid messing with distribution provided files.
Reply all
Reply to author
Forward
0 new messages