From 1bed8d3ae6d1b3d91835cd27842bc775d345caa7 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 4 Sep 2023 22:25:13 -0400 Subject: [PATCH] Added changed_when and converted to builtin.command --- tasks/run_backup.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tasks/run_backup.yml b/tasks/run_backup.yml index 9bc5eea..abbcce9 100644 --- a/tasks/run_backup.yml +++ b/tasks/run_backup.yml @@ -1,8 +1,10 @@ --- - name: (RUN BACKUP) Run backup script - ansible.builtin.shell: - cmd: "{{ restic_script_dir }}/backup-{{ item.name | replace(' ', '') }}.sh" + ansible.builtin.command: + cmd: "/usr/bin/env sh {{ restic_script_dir }}/backup-{{ item.name | replace(' ', '') }}.sh" no_log: "{{ restic_no_log }}" with_items: '{{ restic_backups }}' when: - item.name is defined + register: result + changed_when: result.rc != 0