aboutsummaryrefslogtreecommitdiff
path: root/files/syncthing.fact
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--files/syncthing.fact23
1 files changed, 23 insertions, 0 deletions
diff --git a/files/syncthing.fact b/files/syncthing.fact
new file mode 100644
index 0000000..79ea632
--- /dev/null
+++ b/files/syncthing.fact
@@ -0,0 +1,23 @@
+#!/usr/bin/env perl
+###############################################################################
+# \_o< WARNING : This file is being managed by ansible! >o_/ #
+# ~~~~ ~~~~ #
+###############################################################################
+
+use strict;
+use warnings;
+
+use JSON::PP;
+use LWP::UserAgent;
+
+my $id = '0000000-0000000-0000000-0000000-0000000-0000000-0000000-0000000';
+
+my $resp = LWP::UserAgent->new()->head('http://localhost:8384/');
+if ($resp->code == 200) {
+ $id = $resp->header('X-Syncthing-Id');
+}
+
+my %output = (
+ 'id' => $id,
+);
+print encode_json \%output;