From 96da8149f07c4142c67a72f46924686e5e60f806 Mon Sep 17 00:00:00 2001 From: les Date: Mon, 4 Jan 2021 21:20:47 +0100 Subject: [PATCH] check if restic init is failing --- roles/stable/restic/tasks/main.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/roles/stable/restic/tasks/main.yml b/roles/stable/restic/tasks/main.yml index 3050aee..7600225 100644 --- a/roles/stable/restic/tasks/main.yml +++ b/roles/stable/restic/tasks/main.yml @@ -65,3 +65,11 @@ environment: RESTIC_REPOSITORY: "sftp:{{ restic_ssh_host }}:{{ restic_repository_name }}" RESTIC_PASSWORD: "{{restic_password}}" + no_log: true + register: restic_init + changed_when: "'created restic repository' in restic_init.stdout" + failed_when: + - restic_init.rc != 0 + - not 'config file already exists' in restic_init.stderr + - not 'config already initialized' in restic_init.stderr + - not 'config already exists' in restic_init.stderr \ No newline at end of file