diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-06-20 22:32:35 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-06-20 22:32:35 +0200 |
commit | 5b100712c03c9233ec89d6a30d568d3d296eab1a (patch) | |
tree | 9d6e7e92728e1370cade5bc5bbf97896d4e5ba58 /manifests/conf.pp | |
parent | fixes (diff) | |
download | concourse-5b100712c03c9233ec89d6a30d568d3d296eab1a.tar.gz concourse-5b100712c03c9233ec89d6a30d568d3d296eab1a.tar.xz |
fixes
Diffstat (limited to 'manifests/conf.pp')
-rw-r--r-- | manifests/conf.pp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/manifests/conf.pp b/manifests/conf.pp new file mode 100644 index 0000000..86802ee --- /dev/null +++ b/manifests/conf.pp @@ -0,0 +1,45 @@ +# @summary Sets up a environment file. +# +# Configures an environment file along with a systemd dropin unit for +# loading that file. +# +# @param env +# Environment to set. +# @param service +# Which service this environment belongs to. +# Also configures which service file a dropin will be created for, +# along with which service should be notified that its environment +# was updated. +# @param path +# Absolute path to the configuration file. Should generally not be +# manually set. +# @param ensure +# @api private +define concourse::conf ( + Hash[String, String] $env, + String $service, + Stdlib::Abspath $path = "${concourse::confdir::conf_dir}/${name}", + Enum['absent', 'present'] $ensure = 'present', +) { + include concourse::confdir + + file { $path: + ensure => $ensure, + content => epp("${module_name}/env.epp", { 'entries' => $env }), + show_diff => false, + mode => '0600', + notify => Service[$service], + } + + $dropin_content = @("EOF") + [Service] + EnvironmentFile=${path} + | EOF + + systemd::dropin_file { "concourse-${name}.conf": + ensure => $ensure, + unit => $concourse::web::service_unit, + content => $dropin_content, + notify_service => true, + } +} |