diff --git a/roles/common/tasks/git.yml b/roles/common/tasks/git.yml index 2cd87b8..c0fed57 100644 --- a/roles/common/tasks/git.yml +++ b/roles/common/tasks/git.yml @@ -376,17 +376,18 @@ }} with_items: "{{ git_backup_repositories }}" + register: common_git_backup_result loop_control: label: "{{ item.name }}" - when: "groups['backup_server']|string is search(inventory_hostname)" + when: inventory_hostname in (groups['backup_server'] | default([])) failed_when: >- - failed and ( - msg is not defined or ( - ('Could not resolve host' not in msg) - and ('Connection timed out' not in msg) - and ('Failed to connect to' not in msg) - and ('Connection reset by peer' not in msg) - and ('Operation timed out' not in msg) + (common_git_backup_result.failed | default(false)) and ( + common_git_backup_result.msg is not defined or ( + ('Could not resolve host' not in common_git_backup_result.msg) + and ('Connection timed out' not in common_git_backup_result.msg) + and ('Failed to connect to' not in common_git_backup_result.msg) + and ('Connection reset by peer' not in common_git_backup_result.msg) + and ('Operation timed out' not in common_git_backup_result.msg) ) ) tags: @@ -414,17 +415,18 @@ }} with_items: "{{ git_samba_repositories }}" + register: common_git_samba_result loop_control: label: "{{ item.name }}" - when: "groups['samba_server']|string is search(inventory_hostname)" + when: inventory_hostname in (groups['samba_server'] | default([])) failed_when: >- - failed and ( - msg is not defined or ( - ('Could not resolve host' not in msg) - and ('Connection timed out' not in msg) - and ('Failed to connect to' not in msg) - and ('Connection reset by peer' not in msg) - and ('Operation timed out' not in msg) + (common_git_samba_result.failed | default(false)) and ( + common_git_samba_result.msg is not defined or ( + ('Could not resolve host' not in common_git_samba_result.msg) + and ('Connection timed out' not in common_git_samba_result.msg) + and ('Failed to connect to' not in common_git_samba_result.msg) + and ('Connection reset by peer' not in common_git_samba_result.msg) + and ('Operation timed out' not in common_git_samba_result.msg) ) ) tags: