blob: 3e22d7a3de6376754e7bdf3e1d0cb4765e7dac79 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# the env $name must be unique
define runit::service::env( $service, $value, $ensure = present ) {
$envdir = "/etc/sv/${service}/env"
# create this directory if at least one environment variable is defined
if !defined( File["/etc/sv/${service}/env"] ) {
file{ "/etc/sv/${service}/env":
ensure => directory,
# all unmanaged envs. will be removed
recurse => true,
purge => true,
}
}
# runit::directory { $envdir: }
file { "${envdir}/${name}":
ensure => $ensure,
content => "${value}\n",
}
}
|