The only trickiness that I'm aware of is in the file
resource type.
Backup for replaced files behaves differently, using the server's filebucket by default instead of the local filebucket.
The more significant thing to be aware of is the source
parameter.
source => '/tmp/somepath/sshd_config',
With a raw file path, it'll always try the local path.
source => 'puppet://puppetmaster1/modules/sshd/sshd_config',
With a puppet://server/
path, it'll always try the remote path.
source => 'puppet:///modules/sshd/sshd_config',
With an empty server specification, then it gets interesting.
Applied locally, the local puppet module path is used to find the file.
When reporting to a puppetmaster, the server that gave it the manifest is treated as the server.
Additionally, if you need to get creative about the source of a file, you can give the source
parameter a list:
source => [ '/tmp/somepath/sshd_config', 'puppet:///modules/sshd/sshd_config'],
The first location where something's found will be used.
Answer the meta question of how do you make this work, If you're using Passenger to run your Puppet master, which you should if you've a system of any size, there is a simple workaround to the madness that is the puppetlabs module. You simply drop a new file called /etc/puppet/puppetmaster.conf and maybe some other bits of config in a new module called puppetmaster and also add this line to the config.ru
ARGV << "--config=/etc/puppet/puppetmaster.conf"
You can use some of the logic inside the puppetlabs module, but it might be simpler to just push a file or less complex template if you don't care about having every single bit of config as a parameter. Then include puppetmaster on the nodes that are masters and you're set. You can also modify the existing puppetlabs to do the above.
Addressing the original question, Hiera might be the simplest solution. Use this in the init.pp
$master = hiera('puppet_master','false'),
and then set puppet_master: true for the machines that need it. Personally my preference is for the first method.
Best Answer
You should use a define or a parametrized class, that way you can get
name
to what you like (IMHO, should be a define):And correct your template to: