Skip to content

Commit

Permalink
Define systemd service on Ubuntu 16.04+
Browse files Browse the repository at this point in the history
  • Loading branch information
jimryan committed Mar 10, 2017
1 parent ceb2269 commit 89f2736
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions recipes/_define_service.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# encoding: utf-8

if node['vsftpd']['enabled']
service 'vsftpd' do
provider Chef::Provider::Service::Upstart if node['platform'] == 'ubuntu' &&
node['platform_version'].to_f >= 14.04
action [:enable, :start]
supports restart: true
service 'vsftpd' do
if node['platform'] == 'ubuntu'
if node['platform_version'].to_f >= 16.04
provider Chef::Provider::Service::Systemd
elsif node['platform_version'].to_f >= 14.04
provider Chef::Provider::Service::Upstart
end
end
else
service 'vsftpd' do
provider Chef::Provider::Service::Upstart if node['platform'] == 'ubuntu' &&
node['platform_version'].to_f >= 14.04

if node['vsftpd']['enabled']
action [:enable, :start]
else
action [:disable, :stop]
supports restart: true
end

supports restart: true
end

0 comments on commit 89f2736

Please sign in to comment.