14
|
1 from pyinfra import host
|
|
2 from pyinfra.facts.server import LinuxDistribution
|
|
3 from pyinfra.operations import apt, systemd
|
|
4
|
|
5 bang_is_old = True # remove after upgrade
|
|
6 is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux']
|
|
7 is_wifi_pi = host.name in ['frontdoor', 'living']
|
|
8
|
|
9 # bang instance is in k8s (/my/serv/filesync/syncthing); the rest are run with systemd.
|
|
10 # Configs are in ~/.config/syncthing/ on each box
|
|
11 if host.name in ['dash', 'dot', 'slash', 'plus']:
|
|
12 apt.packages(packages=['syncthing'])
|
|
13
|
|
14 # now we have /lib/systemd/system/syncthing@.service
|
|
15 user = 'ari' if host.name == 'dot' else 'drewp'
|
|
16 systemd.service(service=f'syncthing@{user}', running=True, enabled=True)
|
|
17
|
|
18 # also consider https://github.com/Martchus/syncthingtray tray status viewer on dtops
|