initial
This commit is contained in:
28
manifests/defines/env_fact.pp
Normal file
28
manifests/defines/env_fact.pp
Normal file
@@ -0,0 +1,28 @@
|
||||
# $Id: env_fact.pp 2479 2009-05-16 12:02:33Z uwaechte $
|
||||
|
||||
define puppet::env_fact(
|
||||
$factname="",
|
||||
$value,
|
||||
$ensure="present"
|
||||
){
|
||||
$factname_real = $factname ? {
|
||||
"" => upcase($name),
|
||||
default => upcase($factname)
|
||||
}
|
||||
if defined(Exec["create-env_fact.sh"]){
|
||||
debug("already defined.")
|
||||
}else{
|
||||
exec{"create-env_fact.sh":
|
||||
command => "echo \"#/bin/sh\n\" >>/etc/profile.d/env_facts.sh && chmod a+xr /etc/profile.d/env_facts.sh",
|
||||
onlyif => "test ! -e /etc/profile.d/env_facts.sh",
|
||||
before => Line["env_fact-${factname_real}"],
|
||||
path => ["/usr/bin", "/bin" ],
|
||||
}
|
||||
}
|
||||
|
||||
line{"env_fact-${factname_real}":
|
||||
line => "export FACTER_${factname_real}=${value}",
|
||||
file => "/etc/profile.d/env_facts.sh",
|
||||
ensure => $ensure,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user