-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74fb45a
commit 31c1cd3
Showing
18 changed files
with
628 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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,18 @@ | ||
source ENV['GEM_SOURCE'] || 'https://rubygems.org' | ||
|
||
puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['>= 3.3'] | ||
gem 'metadata-json-lint' | ||
gem 'puppet', puppetversion | ||
gem 'puppetlabs_spec_helper', '>= 1.0.0' | ||
gem 'puppet-lint', '>= 1.0.0' | ||
gem 'facter', '>= 1.7.0' | ||
gem 'rspec-puppet' | ||
|
||
# rspec must be v2 for ruby 1.8.7 | ||
if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' | ||
gem 'rspec', '~> 2.0' | ||
gem 'rake', '~> 10.0' | ||
else | ||
# rubocop requires ruby >= 1.9 | ||
gem 'rubocop' | ||
end |
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,25 @@ | ||
BSD 2-Clause License | ||
|
||
Copyright (c) 2017, Rainbow | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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,55 @@ | ||
# puppet_deluge | ||
|
||
#### Table of Contents | ||
|
||
1. [What Does This Do?](#What-does-this-do) | ||
2. [Requirements](#Requirements) | ||
3. [I Can't Connect?](#I-cant-connect) | ||
4. [Limitations - OS compatibility, etc.](#limitations) | ||
5. [Development - Guide for contributing to the module](#contribute) | ||
6. [Changelog](#changelog) | ||
|
||
## What does this do? | ||
This is a puppet module, written to allow you to install the Deluge torrent client | ||
on your FreeBSD or Linux server. It makes use of ZFS (on FreeBSD), and manages your deluge user, as well as | ||
folder locations and configs. | ||
Please note, this supersedes the existing module hackerhorse/puppet_freebsd_deluge. | ||
By default, remote access is turned off, but can easily be enabled (see below). | ||
|
||
## Requirements | ||
For Ubuntu, please ensure you install puppetlabs/apt | ||
For ZFS systems, ensure you include puppet_deluge:zfs | ||
For non-ZFS systems, please include puppet_deluge:nozfs | ||
### THIS MODULE WILL NOT WORK IF YOU DO NOT SELECT ONE OF THESE. | ||
|
||
## I can't connect! | ||
Did you edit `./files/auth` and `./files/core.conf`? | ||
By default, Deluge does NOT allow remote connections from the desktop client. | ||
You need to edit `core.conf` and change `"allow_remote": false,` on line 24 to | ||
`"allow_remote": true,` to allow the daemon to talk to a remote client. | ||
You also need to edit `./files/auth` and add your user to a new line. | ||
See http://dev.deluge-torrent.org/wiki/UserGuide/ThinClient#AddUsertotheauthenticationfile | ||
for more information! | ||
|
||
## OS Support | ||
Currently, this module runs on: | ||
* FreeBSD <= 10.0-RELEASE | ||
* Ubuntu Linux 13.10 - 17.04 | ||
|
||
## Contribute | ||
You can contribute by forking https://github.com/RainbowHackerHorse/puppet_deluge | ||
and opening a PR. | ||
|
||
## Changelog | ||
|
||
Changes in 0.2.0: | ||
- Removed external ZFS module dependency and switch to upstream puppet ZFS support, as Puppet supports ZFS. | ||
- Move non-ZFS directory entries to nozfs.pp | ||
- Add zfs.pp for ZFS specifics | ||
- Fix incorrect file locations in nozfs.pp (originally the Ubuntu defaults) | ||
|
||
Changes in 0.1.1: | ||
- Add Ubuntu Linux support | ||
|
||
Changes in 0.1.0: | ||
- Initial release. Cleanup from hackerhorse/puppet_freebsd_deluge |
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,32 @@ | ||
require 'puppetlabs_spec_helper/rake_tasks' | ||
require 'puppet-lint/tasks/puppet-lint' | ||
require 'metadata-json-lint/rake_task' | ||
|
||
if RUBY_VERSION >= '1.9' | ||
require 'rubocop/rake_task' | ||
RuboCop::RakeTask.new | ||
end | ||
|
||
PuppetLint.configuration.send('disable_80chars') | ||
PuppetLint.configuration.relative = true | ||
PuppetLint.configuration.ignore_paths = ['spec/**/*.pp', 'pkg/**/*.pp'] | ||
|
||
desc 'Validate manifests, templates, and ruby files' | ||
task :validate do | ||
Dir['manifests/**/*.pp'].each do |manifest| | ||
sh "puppet parser validate --noop #{manifest}" | ||
end | ||
Dir['spec/**/*.rb', 'lib/**/*.rb'].each do |ruby_file| | ||
sh "ruby -c #{ruby_file}" unless ruby_file =~ %r{spec/fixtures} | ||
end | ||
Dir['templates/**/*.erb'].each do |template| | ||
sh "erb -P -x -T '-' #{template} | ruby -c" | ||
end | ||
end | ||
|
||
desc 'Run metadata_lint, lint, validate, and spec tests.' | ||
task :test do | ||
[:metadata_lint, :lint, :validate, :spec].each do |test| | ||
Rake::Task[test].invoke | ||
end | ||
end |
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,18 @@ | ||
{ | ||
"Gemfile": "36c376f27539ded2a321b2bd432e843b", | ||
"LICENSE": "39d0115029585fd2a07f1805f7dec8b4", | ||
"README.md": "b4c06205888e89933553925a5249f083", | ||
"Rakefile": "f4692851f7e9afcdb02721319e3f18b9", | ||
"files/auth": "40852add33c21cb82f48450d1489c54f", | ||
"files/core.conf": "f3caadd1013f98d1c87a11543cd79242", | ||
"files/freebsd_init.sh": "ed5fc0fb227e9fa49e97a0127c2cb907", | ||
"manifests/freebsd.pp": "492577232f008d73826312023e3aeb26", | ||
"manifests/init.pp": "15ab0a5f152c957fef47d4b4783455fb", | ||
"manifests/nozfs.pp": "169754d21dfa0bece741286c4632302b", | ||
"manifests/ubuntu.pp": "2707a34e1d4bcbb1b5afdba686ebbe20", | ||
"manifests/ubuntulegacy.pp": "2fafbcea8d0015d9c06c338a10d6f11f", | ||
"manifests/zfs.pp": "d080f2ffb272020d2b21558cc7e67936", | ||
"metadata.json": "d33162a0b0bf6be440fe9bece222774f", | ||
"spec/classes/init_spec.rb": "e75fb3ea1fbd13dd02b90f01ba1b9961", | ||
"spec/spec_helper.rb": "0db89c9a486df193c0e40095422e19dc" | ||
} |
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 @@ | ||
localclient:PASSWORDGOESHERE:10 |
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,101 @@ | ||
{ | ||
"file": 1, | ||
"format": 1 | ||
}{ | ||
"info_sent": 0.0, | ||
"lsd": true, | ||
"max_download_speed": -1.0, | ||
"send_info": false, | ||
"natpmp": true, | ||
"move_completed_path": "/torrents/completed", | ||
"peer_tos": "0x00", | ||
"enc_in_policy": 1, | ||
"queue_new_to_top": false, | ||
"ignore_limits_on_local_network": true, | ||
"rate_limit_ip_overhead": true, | ||
"daemon_port": 58846, | ||
"torrentfiles_location": "/torrents/files", | ||
"max_active_limit": 1000, | ||
"geoip_db_location": "/usr/local/share/GeoIP/GeoIP.dat", | ||
"upnp": true, | ||
"utpex": true, | ||
"max_active_downloading": 200, | ||
"max_active_seeding": 500, | ||
"allow_remote": false, | ||
"outgoing_ports": [ | ||
0, | ||
0 | ||
], | ||
"enabled_plugins": [], | ||
"max_half_open_connections": 50, | ||
"download_location": "/torrents/downloading", | ||
"compact_allocation": false, | ||
"max_upload_speed": -1.0, | ||
"plugins_location": "/home/deluge/.config/deluge/plugins", | ||
"max_connections_global": 1000, | ||
"enc_prefer_rc4": true, | ||
"cache_expiry": 60, | ||
"dht": true, | ||
"stop_seed_at_ratio": false, | ||
"stop_seed_ratio": 2.0, | ||
"max_download_speed_per_torrent": -1, | ||
"prioritize_first_last_pieces": false, | ||
"max_upload_speed_per_torrent": -1, | ||
"auto_managed": true, | ||
"enc_level": 2, | ||
"copy_torrent_file": true, | ||
"max_connections_per_second": 20, | ||
"listen_ports": [ | ||
6881, | ||
6891 | ||
], | ||
"max_connections_per_torrent": -1, | ||
"del_copy_torrent_file": false, | ||
"move_completed": false, | ||
"autoadd_enable": false, | ||
"proxies": { | ||
"peer": { | ||
"username": "", | ||
"password": "", | ||
"hostname": "", | ||
"type": 0, | ||
"port": 8080 | ||
}, | ||
"web_seed": { | ||
"username": "", | ||
"password": "", | ||
"hostname": "", | ||
"type": 0, | ||
"port": 8080 | ||
}, | ||
"tracker": { | ||
"username": "", | ||
"password": "", | ||
"hostname": "", | ||
"type": 0, | ||
"port": 8080 | ||
}, | ||
"dht": { | ||
"username": "", | ||
"password": "", | ||
"hostname": "", | ||
"type": 0, | ||
"port": 8080 | ||
} | ||
}, | ||
"dont_count_slow_torrents": false, | ||
"add_paused": false, | ||
"random_outgoing_ports": true, | ||
"max_upload_slots_per_torrent": -1, | ||
"new_release_check": false, | ||
"enc_out_policy": 1, | ||
"seed_time_ratio_limit": 7.0, | ||
"remove_seed_at_ratio": false, | ||
"autoadd_location": "/root", | ||
"max_upload_slots_global": 4, | ||
"seed_time_limit": 0, | ||
"cache_size": 512, | ||
"share_ratio_limit": 0, | ||
"random_port": true, | ||
"listen_interface": "" | ||
} |
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/sh | ||
|
||
# $FreeBSD: head/net-p2p/deluge-cli/files/deluged.in 340872 2014-01-24 00:14:07Z mat $ | ||
# | ||
# PROVIDE: deluged | ||
# REQUIRE: LOGIN | ||
# KEYWORD: shutdown | ||
# | ||
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf | ||
# to enable this service: | ||
# | ||
# MANDATORY: | ||
# | ||
# deluged_enable (bool): Set to NO by default. | ||
# Set it to YES to enable deluged. | ||
# | ||
# deluged_user (str): The UNPRIVILEGED user to run as | ||
# | ||
# OPTIONAL: | ||
# | ||
# deluged_flags (str): Set as needed | ||
# See deluged(1) for more information | ||
# | ||
# deluged_confdir (path): Set to /home/$deluged_user/.config/deluge | ||
# by default | ||
# | ||
# deluged_loglevel (str): Set to "error" by default | ||
# | ||
# deluged_logfile (path): Set to /var/tmp/deluged.log by default | ||
|
||
. /etc/rc.subr | ||
|
||
name="deluged" | ||
rcvar=deluged_enable | ||
|
||
command=/usr/local/bin/${name} | ||
command_interpreter=/usr/local/bin/python2.7 | ||
|
||
pidfile=/var/run/${name}/pid | ||
|
||
start_precmd=${name}_prestart | ||
stop_postcmd=${name}_poststop | ||
|
||
deluged_prestart() | ||
{ | ||
if [ "$deluged_user" = 'asjklasdfjklasdf' ]; then | ||
err 1 "You must set deluged_user to a real, unprivileged user" | ||
fi | ||
|
||
if [ ! -d "/var/run/${name}" ]; then | ||
if [ -e "/var/run/${name}" ]; then | ||
unlink /var/run/${name} | ||
fi | ||
mkdir -p /var/run/${name} | ||
fi | ||
|
||
chmod 0755 /var/run/${name} | ||
chown -R $deluged_user /var/run/${name} | ||
} | ||
|
||
deluged_poststop() | ||
{ | ||
[ -e "$pidfile" ] && unlink $pidfile | ||
[ -d "${pidfile%/pid}" ] && rmdir ${pidfile%/pid} | ||
|
||
[ -e "$deluged_logfile" -a ! -s "$deluged_logfile" ] && | ||
unlink $deluged_logfile | ||
} | ||
|
||
load_rc_config $name | ||
|
||
: ${deluged_enable:="NO"} | ||
: ${deluged_user:="deluge"} | ||
: ${deluged_confdir:="/home/${deluged_user}/.config/deluge"} | ||
: ${deluged_loglevel:="error"} | ||
: ${deluged_logfile:="/var/tmp/${name}.log"} | ||
|
||
required_dirs="$deluged_confdir" | ||
command_args="-c $required_dirs -L $deluged_loglevel -l $deluged_logfile -P $pidfile" | ||
|
||
run_rc_command "$1" |
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,40 @@ | ||
# Class: puppet_deluge::freebsd | ||
# Lightweight deluge module to install a headless deluge server | ||
# This module contains FreeBSD specific functions | ||
# Module written by Rainbow <rainbow@hacker.horse> | ||
# Released under the 2-clause BSD license. | ||
# Depends on snonux/zfs | ||
# | ||
class puppet_deluge::freebsd { | ||
package { 'deluge-cli': | ||
ensure => latest, | ||
require => User['deluge'], | ||
} | ||
package { 'deluge-web': | ||
ensure => absent, | ||
require => User['deluge'], | ||
} | ||
package { 'py27-service_identity': | ||
ensure => latest, | ||
} | ||
file { '/usr/local/etc/rc.d/deluged': | ||
owner => 'root', | ||
group => 'wheel', | ||
mode => '0755', | ||
source => 'puppet:///modules/freebsd_deluge_light/deluged_init.sh', | ||
require => User['deluge'], | ||
} | ||
exec { 'delfirstrun': | ||
command => '/usr/local/bin/deluged', | ||
path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', | ||
user => 'deluge', | ||
require => User['deluge'], | ||
before => File['/home/deluge/.config/deluge/auth'], | ||
unless => 'test -f /home/deluge/.config/', | ||
} | ||
service { 'deluge': | ||
ensure => running, | ||
enable => true, | ||
require => File['/usr/local/etc/rc.d/deluged'], | ||
} | ||
} |
Oops, something went wrong.