I am trying to write cookbook which will work under ubuntu and debian. I am using package that has the same name in ubuntu and debian. But in debian package name doesn't match service name.
Example:
ubuntu - package name = foo, service = foo.
debian - package name = foo, servie = xxxx
I need the name to start/restart service explicitly or notify the service. So, what is the best way, to use right service name? Of course, I can predefine the name in attribute file for ubuntu and debian separatly, but I want to try to do this automatically.
As such differences occur in many cases, there is even an example for this is included in chef's documentation about the service resource:
service 'crond' do
case node['platform']
when 'redhat', 'centos', 'scientific', 'fedora', 'amazon'
service_name 'crond'
when 'debian', 'ubuntu', 'suse'
service_name 'cron'
end
action [:start, :enable]
end