A simple solution to this could be using hiera, but you need to have a parameter in the profile class (by the way, I believe you're mixing profiles with roles).
node 'debian'
{
include role::syslogserver
}
node 'debian2'
{
include role::myotherrole
}
then
class role::myotherrole {
include profile::base
# include other things
}
class role::syslogserver {
$role='syslogserver'
include profile::base
# other stuff(?)
}
class profile::base {
include profile::syslog
#other base services
}
class profile::syslog ( $server=false ) {
validate_bool($server) # this requires puppetlabs-stdlib
if $server {
# include server class
} else {
# include client class
}
}
Now depending on your hiera configuration you can either leverage the role for the hierarchy path or the nodename (I'm not gonna go into details on how to configure hiera because there is plenty of documentation out there)
<snippet from hiera.yaml>
:hierarchy:
- "node/${::fqdn}"
- "role/${::role}"
- common
</snippet>
then in <hieradatadir>/role/syslog.yaml
profile::syslog::server: true
Please forgive me if there are any mistakes in the above, it's been a long time since I did classification like this (now we're using an ENC and json as backend, not yaml). Hopefully you get the idea.
We successfully use the same strategy for smtp, syslog and other services.
Best Regards,
Elisiano Petrini