Here's what I'm trying to do, and I know there's a better way most likely
involving exported resources, but I haven't done much with them before.
I've got two types of nodes deploying custom software which Puppet is
setting up for us. Slave nodes have a config file which gets deployed via
template, and which needs to know the master node's fqdn. There is one
master, and it varies by subnet. Any given subnet will only have one.
Right now, I'm defining the master in a .yaml file in our Hiera hierarchy
so that each system on a subnet knows about the master. The twist is that
the decision to deploy master or slave code is made through a custom fact
which knows about the roles a particular system is supposted to have and
installs the requisite software. So if no one tells me they're deploying a
new subnet, all the slaves get deployed without a master and puppet has to
play catch-up until I get it defined in hiera, and nothing works in the
meantime.
Is the correct approach to have the config defined as an exported resource
from the master, and have it get collected and realized on the slaves?
Something like this:
master.pp:
@@masternode { $fqdn:
# $subnet is a custom fact
subnet => $subnet,
}
masternode.pp:
define masternode (Integer $subnet) {
file { '/path/to/config':
content => template('module/config.erb')
mode => '755',
}
}
slave.pp:
Masternode<| subnet = $subnet |>
Does that look right, or am I completely off the rails?
Thanks!
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/b6e394d0-1431-4731-aade-d41a7d0be16a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.