Dear all,
I would like to use the file resource to supply a host specific file. If it does exist choose it and if not create a file from a template.
I tried this, but then /mnt/motd needs to be on all server.
$a = file("/mnt/motd/motd-${::hostname}",'/dev/null')
if($a != '') {
file {$config_file:
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0644',
source => "puppet:///motd_files/motd/motd-${::hostname}",
}
}
else {
file { $config_file:
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0644',
content => template($template),
}
}
If I try this
$a = file("puppet:///motd_files/motd/motd-${::hostname}",'/dev/null')
I get the error that Files must be fully qualified
Does anybody has a solution for that?
Best regards
Andreas