Skip to content
This repository has been archived by the owner on May 20, 2020. It is now read-only.

Commit

Permalink
Adding support for ubuntu 15.04 and 16.04
Browse files Browse the repository at this point in the history
  • Loading branch information
mskurski committed May 12, 2016
1 parent bf86b73 commit fe08e85
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# mongodb3 Cookbook CHANGELOG

## Next (5.3.0)

* Adding support for ubuntu 15.04 and 16.04. Marcin Skurski([@mskurski](https://github.com/mskurski))
* Changing service provider to `Chef::Provider::Service::Systemd` for ubuntu >= 15.04

## 5.2.0

* PR #35 : bypass dpkg errors about pre-existing init or conf file. Damien Raude-Morvan([@drazzib](https://github.com/drazzib))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

The following platforms have been tested with Test Kitchen

* Ubuntu 12.04, 14.04
* Ubuntu 12.04, 14.04, 15.04, 16.04
* Debian 7.8
* CentOS 6.6, 7.2
* Oralce 6.6
Expand Down
4 changes: 2 additions & 2 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
license 'Apache 2.0'
description 'Installs/Configures mongodb3'
long_description 'Installs/Configures mongodb3'
version '5.2.0'
version '5.3.0'

supports 'ubuntu', '= 12.04'
supports 'ubuntu', '= 16.04'
supports 'debian', '= 7.8'
supports 'redhat', '= 6.6'
supports 'centos', '= 6.6'
Expand Down
15 changes: 14 additions & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,24 @@
helpers Mongodb3Helper
end

# Create the mongod.service file
case node['platform']
when 'ubuntu'
if node['platform_version'].to_f >= 16.04
template '/lib/systemd/system/mongod.service' do
source 'mongod.service.erb'
mode 0644
end
end
end

# Start the mongod service
service 'mongod' do
case node['platform']
when 'ubuntu'
if node['platform_version'].to_f >= 14.04
if node['platform_version'].to_f >= 15.04
provider Chef::Provider::Service::Systemd
elsif node['platform_version'].to_f >= 14.04
provider Chef::Provider::Service::Upstart
end
end
Expand Down
6 changes: 5 additions & 1 deletion recipes/package_repo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@
when 'debian'
apt_repository "mongodb-org-#{pkg_major_version}" do
uri node['mongodb3']['package']['repo']['url']
distribution "#{node['lsb']['codename']}/mongodb-org/#{node['mongodb3']['package']['repo']['apt']['name']}"
if node['platform'] == 'ubuntu' and node['platform_version'].to_f >= 15.04
distribution "trusty/mongodb-org/#{node['mongodb3']['package']['repo']['apt']['name']}"
else
distribution "#{node['lsb']['codename']}/mongodb-org/#{node['mongodb3']['package']['repo']['apt']['name']}"
end
components node['mongodb3']['package']['repo']['apt']['components']
keyserver node['mongodb3']['package']['repo']['apt']['keyserver']
key node['mongodb3']['package']['repo']['apt']['key']
Expand Down
17 changes: 17 additions & 0 deletions templates/default/mongod.service.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[Unit]
Description=High-performance, schema-free document-oriented database
Documentation=man:mongod(1)
After=network.target

[Service]
Type=forking
User=mongodb
Group=mongodb
RuntimeDirectory=mongod
PIDFile=/var/run/mongod/mongod.pid
ExecStart=/usr/bin/mongod -f /etc/mongod.conf --pidfilepath /var/run/mongod/mongod.pid --fork
TimeoutStopSec=5
KillMode=mixed

[Install]
WantedBy=multi-user.target

0 comments on commit fe08e85

Please sign in to comment.