From 8045e014e00560556899a09c26f31fa5aea40379 Mon Sep 17 00:00:00 2001 From: Vitalii Chepeliuk Date: Wed, 18 Apr 2018 10:41:59 +0200 Subject: [PATCH] Add error handling to block statement --- roles/bind-crc-apb/tasks/main.yml | 19 +++++++++---------- roles/provision-crc-apb/tasks/main.yml | 19 +++++++++---------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/roles/bind-crc-apb/tasks/main.yml b/roles/bind-crc-apb/tasks/main.yml index 41fc481..36e5118 100644 --- a/roles/bind-crc-apb/tasks/main.yml +++ b/roles/bind-crc-apb/tasks/main.yml @@ -11,18 +11,17 @@ register: crc_json_config_valid ignore_errors: True -- asb_last_operation: - description: "config was not valid json. Could not bind" - when: crc_json_config_valid.failed +- block: + - asb_last_operation: + description: "config was not valid json. Could not bind" -- lineinfile: - line: 'config was not valid json. Could not bind' - path: '{{ crc_term_msg_filepath }}' - unsafe_writes: true - when: crc_json_config_valid.failed + - lineinfile: + line: 'config was not valid json. Could not bind' + path: '{{ crc_term_msg_filepath }}' + unsafe_writes: true -- fail: - msg: "config was not valid json. Could not bind" + - fail: + msg: "config was not valid json. Could not bind" when: crc_json_config_valid.failed - name: Creating CRC {{ CLIENT_ID }} configmap diff --git a/roles/provision-crc-apb/tasks/main.yml b/roles/provision-crc-apb/tasks/main.yml index d4fe5e4..f9f7547 100644 --- a/roles/provision-crc-apb/tasks/main.yml +++ b/roles/provision-crc-apb/tasks/main.yml @@ -4,18 +4,17 @@ register: crc_json_config_valid ignore_errors: True -- asb_last_operation: - description: "config was not valid json. Could not provision" - when: crc_json_config_valid.failed +- block: + - asb_last_operation: + description: "config was not valid json. Could not provision" -- lineinfile: - line: 'config was not valid json. Could not provision' - path: '{{ crc_term_msg_filepath }}' - unsafe_writes: true - when: crc_json_config_valid.failed + - lineinfile: + line: 'config was not valid json. Could not provision' + path: '{{ crc_term_msg_filepath }}' + unsafe_writes: true -- fail: - msg: "config was not valid json. Could not provision" + - fail: + msg: "config was not valid json. Could not provision" when: crc_json_config_valid.failed - name: Creating CRC {{ crc_svc_config_name }} secrets