aboutsummaryrefslogtreecommitdiff
path: root/templates/syncthing.fact
blob: 406366b1ede3d5c8f4882be53c4e8e81525e31e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env perl
###############################################################################
#     \_o<     WARNING : This file is being managed by ansible!      >o_/     #
#     ~~~~                                                           ~~~~     #
###############################################################################

use strict;
use warnings;

use JSON::PP;

`doas -u {{ syncthing_pre.user_group }} syncthing generate --config {{ syncthing_pre.config_dir }} 2>&1` unless -e "{{ syncthing_pre.config_dir }}/config.xml";

my $id = `doas -u {{ syncthing_pre.user_group }} syncthing -device-id --config {{ syncthing_pre.config_dir }} --data {{ syncthing_pre.data_dir }} 2>&1`;
chomp $id;

my %output = (
	'id' => $id,
);
print encode_json \%output;