From 23e2941b3a6aff6415913cc91198147128260b06 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 22 Jan 2023 00:16:43 +0100 Subject: Imported from personal ansible repository --- files/syncthing.fact | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 files/syncthing.fact (limited to 'files/syncthing.fact') 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; -- cgit v1.2.3