Hello, Here is what I am trying to do: - in a class aptdater::client I want to export the $fqdn - in a class aptdater::master I want to retrieve all the exported $fqdn to fill an erb template of a configuration file
Here is what I tried:
# modules/aptdater/manifests/init.pp
class aptdater {
# some not relevant resources
}
# modules/aptdater/manifests/master.pp
class aptdater::master inherits aptdater {
# list of hosts that will be added to the hosts.conf
$hosts = [$fqdn]
(...)
}
# modules/aptdater/manifests/client.pp
class aptdater::client inherits aptdater {
$aptdater::master::hosts += $fqdn
(...)
}
# modules/aptdater/templates/hosts.conf.erb
[Hosts]
Hosts=<% scope.lookupvar('aptdater::master::hosts').each do |i| -%>
<%= i + ";" -%>
<% end -%>
I have two nodes:
# manifests/nodes/master.node.plop.org.pp
node 'master.node.plop.org' {
include aptdater::master
}
# manifests/nodes/client.node.plop.org.pp
node 'client.node.plop.org' {
include aptdater::client
}
But it does not work, the Hosts line does only contain the $fqdn of the
master node.
I took a look at exported resource, but here it's not a resource that I
want to be exported, it's just a variable/fact.
Is this possible to achieve such a goal?
Thanks,
Baptiste
--
\,,/_[-_-]_\,,/
Start the day with a smile. After that you can be your nasty old self again.
pgpEivdri1XC8.pgp
Description: PGP signature
