bundles/transmission: add bundle, add to home.downloadhelper
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2021-01-08 16:10:44 +01:00
parent dca13263e2
commit 33b85ff0de
Signed by: kunsi
GPG key ID: 12E3D2136B818350
3 changed files with 110 additions and 0 deletions

View file

@ -0,0 +1,21 @@
from bundlewrap.metadata import metadata_to_json
# transmission overwrites this on a restart. As of 2021-01 there's no
# way of disabling that.
files = {
'/etc/transmission-daemon/settings.json': {
'content': metadata_to_json(node.metadata['transmission']['config']),
'mode': '0444',
'triggers': {
'svc_systemd:transmission-daemon:reload',
},
},
}
svc_systemd = {
'transmission-daemon': {
'needs': {
'pkg_apt:transmission-daemon',
},
},
}

View file

@ -0,0 +1,79 @@
defaults = {
'apt': {
'packages': {
'transmission-daemon': {},
'transmission-remote-cli': {},
},
},
'icinga2_api': {
'transmission': {
'services': {
'TRANSMISSION PROCESS': {
'command_on_monitored_host': '/usr/lib/nagios/plugins/check_procs -a transmission-daemon -c 1:',
},
},
},
},
'transmission': {
'config': {
'message-level': 2,
'peer-port': 51413,
'port-forwarding-enabled': False,
'rename-partial-files': True,
'rpc-authentication-required': False,
'rpc-bind-address': '0.0.0.0',
'rpc-enabled': True,
'rpc-host-whitelist-enabled': False,
'rpc-port': 9091,
'rpc-url': '/transmission/',
'rpc-whitelist-enabled': False,
'start-added-torrents': True,
},
},
}
@metadata_reactor.provides(
'iptables/bundle_rules/transmission',
)
def iptables(metadata):
interfaces = metadata.get('transmission/webinterface-on-interfaces', set())
iptables = []
iptables.append('iptables_both -A INPUT -p udp --dport {} -j ACCEPT'.format(
metadata.get('transmission/config/peer-port'),
))
for iface in sorted(interfaces):
iptables.append('iptables_both -A INPUT -i {} -p tcp --dport {} -j ACCEPT'.format(
iface,
metadata.get('transmission/config/rpc-port'),
))
return {
'iptables': {
'bundle_rules': {
'transmission': iptables,
},
},
}
@metadata_reactor.provides(
'icinga2_api/transmission/services',
)
def icinga_web(metadata):
port = metadata.get('transmission/config/rpc-port')
path = metadata.get('transmission/config/rpc-url')
return {
'icinga2_api': {
'transmission': {
'services': {
'TRANSMISSION WEB INTERFACE': {
'command_on_monitored_host': f'/usr/local/share/icinga/plugins/check_http_url_for_string http://127.0.0.1:{port}{path} "Transmission"',
},
},
},
},
}

View file

@ -3,6 +3,7 @@ nodes['home.downloadhelper'] = {
'bundles': {
'iptables',
'nfs-client',
'transmission',
},
'groups': {
'debian-buster',
@ -40,5 +41,14 @@ nodes['home.downloadhelper'] = {
},
},
},
'transmission': {
'config': {
'download-dir': '/mnt/nas',
'download-queue-size': 10,
},
'webinterface-on-interfaces': {
'enp1s0.42',
},
},
},
}