how i can inherit variable from puppet manifest in facter custom fact? in this case $job_name varible. I want use same custom fact with different envs.
if $facts['hostname'] =~ /.*name.*/ {
$job_name = 'test'
file { "/opt/$job_name":
ensure => directory,
owner => 'root',
group => 'root',
mode => '0775',
}
file { "/opt/$job_name/version.$job_name":
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
#notify => Exec["update_test"],
source => "puppet:///modules/test/version.$job_name",
}
if $facts['check_version'] == "aasdadsadasd" {
file { "/opt/$job_name/bla2":
ensure => directory,
owner => 'root',
group => 'root',
mode => '0775',
}
}
my custom fact rb code is
require 'facter'
Facter.add(:check_version) do
setcode do
Facter::Core::Execution.exec("/bin/cat /opt/$job_name/version.$job_name")
end
end
thanks in advance