summaryrefslogtreecommitdiff
path: root/files/syncthing.fact
diff options
context:
space:
mode:
authorJulien Dessaux2023-01-22 00:16:43 +0100
committerJulien Dessaux2023-01-22 00:20:57 +0100
commit23e2941b3a6aff6415913cc91198147128260b06 (patch)
tree5c9f27dace6a077a447d5f1267de033b454f0f42 /files/syncthing.fact
parentInitial import (diff)
downloadsyncthing-ansible-role-23e2941b3a6aff6415913cc91198147128260b06.tar.gz
syncthing-ansible-role-23e2941b3a6aff6415913cc91198147128260b06.tar.bz2
syncthing-ansible-role-23e2941b3a6aff6415913cc91198147128260b06.zip
Imported from personal ansible repository1.0
Diffstat (limited to 'files/syncthing.fact')
-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;