summaryrefslogtreecommitdiff
path: root/manifests/syncthing.pp
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-01-24 23:39:46 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-02-09 18:06:12 +0100
commit3772007c10963175dfa0acba24a5753073e50cd2 (patch)
treefb0fde895e13b9e0426d7650ded6a7e1a440a00f /manifests/syncthing.pp
parentMinor transmission changes. (diff)
downloadprofiles-3772007c10963175dfa0acba24a5753073e50cd2.tar.gz
profiles-3772007c10963175dfa0acba24a5753073e50cd2.tar.xz
Syncthing rewrites.
Diffstat (limited to 'manifests/syncthing.pp')
-rw-r--r--manifests/syncthing.pp53
1 files changed, 49 insertions, 4 deletions
diff --git a/manifests/syncthing.pp b/manifests/syncthing.pp
index 7d8183e..9580905 100644
--- a/manifests/syncthing.pp
+++ b/manifests/syncthing.pp
@@ -1,13 +1,33 @@
class profiles::syncthing (
- Array[String] $enable_for = []
+ $data,
+ Array[String] $enable_for = [],
) {
- # TODO add repo for those systems that need it
+ case $facts['osfamily'] {
+ 'Debian': {
+ file { '/etc/apt/trusted.gpg.d/syncthing.gpg':
+ ensure => file,
+ source => 'https://syncthing.net/release-key.gpg',
+ checksum => 'sha256',
+ checksum_value => 'a3806c3511f2cce3d2f12962f64b58b9192a15c9d862886cc46f9de8a25d7dbf',
+ }
+
+ ensure_resource(exec, { 'apt update' => { refreshonly => true }})
+
+ file { '/etc/apt/sources.list.d/syncthing.list':
+ content => "deb https://apt.syncthing.net/ syncthing stable\n",
+ # TODO more general way to add apt repos
+ notify => Exec['apt update'],
+ before => Package['syncthing']
+ }
+ }
+ }
package { 'syncthing':
ensure => installed
}
+
systemd::dropin_file { 'nospam.conf':
unit => 'syncthing@.service',
content => @(EOF)
@@ -18,11 +38,36 @@ class profiles::syncthing (
}
$enable_for.map |$user| {
- service { "syncthing@${user}":
- enable => true,
+
+ user { $user:
+ home => "/home/${user}",
+ managehome => true,
+ }
+
+ $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 => [
+ 'set gui/#attribute/enabled false',
+ ],
}
}
# TODO manage synced data
+
}