From d6ddb6345912c473b6bd257fe96f52768197c388 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20-=20Le=20Filament?= <remi@le-filament.com>
Date: Tue, 8 Jun 2021 08:54:49 +0200
Subject: [PATCH] Add check to not push backups if Backup_Server

---
 templates/collect_docker_facts.sh.j2 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/templates/collect_docker_facts.sh.j2 b/templates/collect_docker_facts.sh.j2
index 72a283b..a76e7a4 100644
--- a/templates/collect_docker_facts.sh.j2
+++ b/templates/collect_docker_facts.sh.j2
@@ -24,8 +24,10 @@ printf "\n\n-- Usage Statistics --\n" >> $file
 cp $file $latest_file
 chmod 644 $file $latest_file
 {% for host in groups.backup_server %}
+{% if host != inventory_hostname %}
 sftp -P {{ default_sshd_port }} -o IdentityFile=/home/{{ host_user }}/.ssh/id_ed25519 {{ backup_sftp_user }}@{{ hostvars[host].ansible_host }} << COMMANDS
 put $file {{ inventory_hostname|lower }}/
 quit
 COMMANDS
+{% endif %}
 {% endfor %}
-- 
GitLab