1
0
Fork 0
This repository has been archived on 2025-03-10. You can view files and clone it, but cannot push or open issues or pull requests.
ansible-role-syncthing/templates/syncthing.fact

20 lines
769 B
Perl

#!/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;