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.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/5qYy2sAXf7sJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to