summaryrefslogtreecommitdiff
path: root/manifests/syncthing.pp
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-12-31 17:11:33 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-12-31 17:37:35 +0100
commite675fe20abde4db5f5764ed52c0ddc0674533b21 (patch)
tree1e2c4c3e8a55e70311579d408e41b169faf71ddc /manifests/syncthing.pp
parentDisable more games. (diff)
downloadprofiles-e675fe20abde4db5f5764ed52c0ddc0674533b21.tar.gz
profiles-e675fe20abde4db5f5764ed52c0ddc0674533b21.tar.xz
Reworte syncthing.
Diffstat (limited to 'manifests/syncthing.pp')
-rw-r--r--manifests/syncthing.pp132
1 files changed, 31 insertions, 101 deletions
diff --git a/manifests/syncthing.pp b/manifests/syncthing.pp
index e31449a..389590c 100644
--- a/manifests/syncthing.pp
+++ b/manifests/syncthing.pp
@@ -1,7 +1,9 @@
+# Sets up a syncthing node, available to the net.
+# Doesn't configure reverse proxies or firewalls.
+# Also doesn't manage devices or folders in the instance. Those are
+# currently seen as program state
class profiles::syncthing (
- $data,
Array[String] $enable_for = [],
- Array[String] $augrules = [],
) {
class { 'syncthing':
@@ -10,8 +12,8 @@ class profiles::syncthing (
systemd::dropin_file { 'nospam.conf':
- ensure => absent,
- unit => 'syncthing@.service',
+ ensure => absent,
+ unit => 'syncthing@.service',
content => @(EOF)
[Service]
ExecStart=
@@ -21,107 +23,35 @@ class profiles::syncthing (
$enable_for.map |$user| {
- user { $user:
- home => "/home/${user}",
- managehome => true,
- }
-
-
- $hp = "/home/${user}/.config/syncthing"
+ # TODO create deferred function returning passwd entries
+ # {{{ruby
+ # require 'etc'
+ # Etc.getpwnam('hugo')
+ # }}}
+ # {{{
+ # => #<struct Etc::Passwd name="hugo", passwd="x",
+ # uid=1000, gid=1000,
+ # gecos="Hugo Hörnquist",
+ # dir="/home/hugo", shell="/bin/bash">
+ # }}}
+ $home = "/home/${user}"
+
+ $conf_dir = "/home/${user}/.config/syncthing"
syncthing::instance { $user:
- home_path => $hp,
- daemon_uid => $user,
- }
-
- $data['devices'].each |$name, $d| {
- syncthing::device { $name:
- home_path => $hp,
- instance_name => $user,
- id => $d['id'],
- }
- }
-
- $data['folders'].each |$name, $d| {
- syncthing::folder { $name:
- home_path => $hp,
- instance_name => $user,
- id => $d['id'],
- path => $d['path'],
- devices => $d['devices'].map |$name| { [ $data['devices'][$name]['id'], 'present' ] }.hash
+ home_path => $conf_dir,
+ daemon_uid => $user,
+ gui => true,
+ gui_tls => false,
+ gui_address => '[::]',
+ # TODO ldap
+ gui_port => 8384,
+ options => {
+ 'startBrowser' => 'false',
}
+ # defaults
}
- # $dir = "/home/${user}/.config/syncthing"
- # file { "/home/${user}/.config":
- # ensure => directory,
- # owner => $user,
- # group => $user,
- # }
- # exec { "/usr/bin/syncthing -generate='${dir}'":
- # user => $user,
- # creates => $dir,
- # }
-
- # # service { "syncthing@${user}":
- # # enable => true,
- # # }
-
- # # augeas { 'syncthing_config':
- # # # context => "/files/home/${user}.config/syncthing/config.xml/configuration",
- # # changes => [
- # # "defvar base /home/${user}/.config/syncthing/",
- # # 'set /augeas/load/Xml/incl[1] $base/*.xml',
- # # 'load',
- # # 'defvar $ctx $base/config.xml/configuration',
- # # 'set $ctx/gui/#attribute/enabled false',
- # # 'save',
- # # 'rm $ctx/folder/',
- # # 'set $ctx/folder[0]/#attribute/label Documentns',
- # # 'set $ctx/folder[0]/#attribute/path ~/sync/doc',
- # # 'set $ctx/folder[0]/#attribute/id rrrr-xxxx',
- # # 'set $ctx/folder[0]/#attribute/device[0]/#attribute/id something-really-long',
- # # 'save',
- # # ],
- # # }
-
- # $device_rules = flatten($data['devices'].map |$name, $d| {
- # [
- # "defnode node device[#attribute/name=$name] ''",
- # "set \$node/#attribute/name ${name}",
- # "set \$node/#attribute/id ${d['id']}",
- # ]
- # })
-
- # $folder_rules = flatten($data['folders'].map |$name, $d| {
- # [
- # "defnode node folder[#attribute/label=$name] ''",
- # "set \$node/#attribute/label ${name}",
- # "set \$node/#attribute/path ${d['path']}",
- # "set \$node/#attribute/id ${d['id']}",
- # ] + flatten($d['devices'].map |$name| {
- # alert($name)
- # alert($data['devices'][$name])
- # [ "set \$node/device[0]/#attribute/id ${data['devices'][$name]['id']}", ]
- # })
- # })
-
- # augeas { 'syncthing-config':
- # lens => 'Xml.lns',
- # incl => "/home/${user}/.config/syncthing/config.xml",
- # context => "/files/home/${user}/.config/syncthing/config.xml/configuration",
- # changes => $device_rules + $folder_rules,
- # # [
- # # 'rm folder/',
- # # 'set folder[0]/#attribute/label Documentsn',
- # # 'set folder[0]/#attribute/path ~/sync/doc',
- # # # 'set folder[0]/#attribute/id rrrr-xxxx',
- # # # 'set folder[0]/#attribute/device[0]/#attribute/id something-really-long',
- # # ],
- # }
+ # ensure_packages(['syncthing-gtk-python3'])
}
-
- # # TODO manage synced data
-
-
}