This repository has been archived by the owner on Dec 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Debian support to the Puppet Module
Minor changes after running puppet-lint
- Loading branch information
Showing
8 changed files
with
222 additions
and
57 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,48 @@ | ||
class artifactory::install inherits artifactory { | ||
$url = "http://dl.bintray.com/jfrog/artifactory/artifactory-${app_version}.zip" | ||
|
||
if $caller_module_name != $module_name { | ||
fail("Use of private class ${name} by ${caller_module_name}") | ||
} | ||
|
||
staging::deploy { "artifactory-${app_version}.zip": | ||
source => $url, | ||
target => $app_dir, | ||
creates => "$app_dir/artifactory-${app_version}" | ||
} | ||
if $::osfamily == 'Debian' { | ||
|
||
$url = "http://dl.bintray.com/jfrog/artifactory/artifactory-${artifactory::app_version}.zip" | ||
$artifactory::extracted = "${artifactory::app_dir}/artifactory-${artifactory::app_version}" | ||
|
||
file { $app_data: | ||
ensure => directory, | ||
mode => '0755', | ||
owner => $username, | ||
group => $username | ||
if $caller_module_name != $module_name { | ||
fail("Use of private class ${name} by ${caller_module_name}") | ||
} | ||
|
||
file { $artifactory::app_data: | ||
ensure => directory, | ||
mode => '0755', | ||
owner => $artifactory::username, | ||
group => $artifactory::username | ||
} | ||
-> file { $artifactory::app_dir: | ||
ensure => directory, | ||
mode => '0755', | ||
owner => $artifactory::username, | ||
group => $artifactory::username | ||
} | ||
-> staging::deploy { "artifactory-${artifactory::app_version}.zip": | ||
source => $url, | ||
creates => $artifactory::extracted, | ||
target => $artifactory::app_dir, | ||
user => $artifactory::username, | ||
group => $artifactory::username | ||
} | ||
-> file { "${artifactory::app_dir}/current": | ||
ensure => link, | ||
target => $artifactory::extracted | ||
} | ||
-> file { "${artifactory::app_dir}/current/data": | ||
ensure => link, | ||
target => $artifactory::app_data | ||
} | ||
|
||
} elsif $::osfamily == 'RedHat' { | ||
package { 'artifactory': | ||
ensure => installed, | ||
provider => 'rpm', | ||
source => "http://downloads.sourceforge.net/project/artifactory/artifactory/${artifactory::app_version}/artifactory-${artifactory::app_version}.rpm", | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
# == Class Artifactory::Params | ||
# Contains all the parameters for the Artifactory module | ||
class artifactory::params { | ||
$username = 'artifactory', | ||
$pass_hash = undef, | ||
$manage_java = false, | ||
$java_version = '7', | ||
$app_dir = '/opt/artifactory', | ||
$app_data = '/var/artifactory', | ||
$username = 'artifactory' | ||
$pass_hash = undef | ||
$manage_java = false | ||
$java_version = '7' | ||
$app_dir = '/opt/artifactory' | ||
$app_data = '/var/artifactory' | ||
$app_version = '3.3.0' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
class artifactory::server inherits artifactory { | ||
|
||
# service { 'artifactory': | ||
# ensure => 'running', | ||
# enable => "true", | ||
# hasstatus => "false", | ||
# provider => "redhat", | ||
# require => Package['artifactory'] | ||
# } | ||
class artifactory::service inherits artifactory { | ||
|
||
if $::osfamily == 'Debian' { | ||
|
||
file { '/etc/init.d/artifactory': | ||
ensure => present, | ||
content => template('artifactory/artifactory.Debian.init.erb'), | ||
owner => root, | ||
group => root, | ||
mode => '0755' | ||
} | ||
-> service { 'artifactory': | ||
ensure => 'running', | ||
provider => 'debian', | ||
enable => true, | ||
} | ||
|
||
} elsif $::osfamily == 'RedHat' { | ||
|
||
service { 'artifactory': | ||
ensure => 'running', | ||
enable => true, | ||
hasstatus => false, | ||
provider => 'redhat', | ||
require => Package['artifactory'] | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"name": "maestrodev-artifactory", | ||
"version": "1.0.1", | ||
"author": "maestrodev", | ||
"summary": "A really simple module to install Artifactory", | ||
"license": "Apache License, Version 2.0", | ||
"source": "http://github.com/maestrodev/puppet-artifactory", | ||
"project_page": "http://github.com/maestrodev/puppet-artifactory", | ||
"issues_url": "https://github.com/maestrodev/puppet-artifactory/issues", | ||
"description": "Installs Artifactory package and service", | ||
"requirements": [ | ||
{ | ||
"name": "pe", | ||
"version_requirement": ">=3.2.0 <3.4.0" | ||
}, | ||
{ | ||
"name": "puppet", | ||
"version_requirement": ">=3.0.0 <4.0.0" | ||
} | ||
], | ||
"operatingsystem_support": [ | ||
{ | ||
"operatingsystem": "RedHat", | ||
"operatingsystem_release": [ | ||
"6" | ||
] | ||
}, | ||
{ | ||
"operatingsystem": "Centos", | ||
"operatingsystem_release": [ | ||
"6" | ||
] | ||
}, | ||
{ | ||
"operatingsystem": "Ubuntu", | ||
"operatingsystem_release": [ | ||
"12.04", | ||
"14.04" | ||
] | ||
} | ||
], | ||
"dependencies": [ | ||
{ | ||
"name": "puppetlabs/stdlib", | ||
"version_requirement": ">=4.0.0 <5.0.0" | ||
}, | ||
{ | ||
"name": "nanliu/staging", | ||
"version_requirement": ">=0.4.1 <1.0.0" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/bash | ||
|
||
### BEGIN INIT INFO | ||
# Provides: artifactory | ||
# Required-Start: $local_fs $network $remote_fs | ||
# Required-Stop: $local_fs $network $remote_fs | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: start and stop artifactory | ||
# Description: Artifactory is an artifact management server, written by JFrog | ||
### END INIT INFO | ||
|
||
RETVAL=0 | ||
LOCKFILE=/var/lock/artifactory | ||
logfile=/var/log/artifactory | ||
artifactory_dir=<%= @app_dir %>/current | ||
artifactory_data=<%= @app_data %> | ||
user=<%= @username %> | ||
DAEMON_START="$artifactory_dir/bin/artifactory.sh" | ||
DAEMON_STOP="$artifactory_dir/tomcat/bin/catalina.sh" | ||
DAEMON_ARGS="start" | ||
|
||
start() { | ||
export CATALINA_OUT=$logfile | ||
export ARTIFACTORY_HOME=$artifactory_data | ||
|
||
if [ -e $LOCKFILE ] | ||
then | ||
echo "$LOCKFILE exists, Artifactory already running" | ||
exit 1 | ||
fi | ||
|
||
if [ -e '/etc/default/artifactory' ] | ||
then | ||
source /etc/default/artifactory | ||
fi | ||
|
||
touch $LOCKFILE | ||
touch $logfile | ||
chown $user $logfile | ||
echo "Starting Artifactory" | ||
start-stop-daemon -c $user --start --quiet --exec $DAEMON_START $DAEMON_ARGS > /dev/null || return 1 | ||
} | ||
|
||
stop() { | ||
echo "Stopping Artifactory" | ||
rm $LOCKFILE | ||
su -l $user -c "$DAEMON_STOP stop" > /dev/null | ||
rm $PIDFILE | ||
} | ||
|
||
status() { | ||
PIDFILE=$artifactory_dir/run/artifactory.pid | ||
if [ -e $LOCKFILE ] && [ -e $PIDFILE ] | ||
then | ||
pid=`cat $PIDFILE` | ||
echo "Artifactory is running with pid $pid" | ||
else | ||
echo "Artifactory is stopped" | ||
fi | ||
} | ||
|
||
|
||
case "$1" in | ||
start) | ||
start | ||
;; | ||
stop) | ||
stop | ||
;; | ||
restart) | ||
stop | ||
start | ||
;; | ||
status) | ||
status | ||
;; | ||
*) | ||
echo $"Usage: $0 {start|stop|restart|status}" | ||
exit 2 | ||
esac |