X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=installation%2Fansible-server%2Fsrc%2Fmain%2FPlaybooks%2Fansible_huawei_rollback%400.00.yml;h=8d8982afabb84055da135dbfe0791c0d9b05f716;hb=83ff8436156f3f976eff2633b0c54b9426d11a25;hp=0d20bc3ed2f1fb7e74c1426bc2883c55e6280329;hpb=9e1fedca46f1df1059a2b7bb927d94b911f27c68;p=sdnc%2Foam.git diff --git a/installation/ansible-server/src/main/Playbooks/ansible_huawei_rollback@0.00.yml b/installation/ansible-server/src/main/Playbooks/ansible_huawei_rollback@0.00.yml index 0d20bc3e..8d8982af 100644 --- a/installation/ansible-server/src/main/Playbooks/ansible_huawei_rollback@0.00.yml +++ b/installation/ansible-server/src/main/Playbooks/ansible_huawei_rollback@0.00.yml @@ -3,6 +3,27 @@ tasks: - name: execute swFallback operation - shell: ./swm/swFallback.sh --filter {{filter}} - register: fallback__result + shell: ./swm/swFallback --filter {{filter}} + ignore_errors: yes + register: fallback_result + + - name: write output to file + local_action: copy content="{{fallback_result.stdout}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt" + when: fallback_result.stdout != "" + + - name: build error message + set_fact: + err_msg: + "reason": "{{fallback_result.stderr}}" + "result": "Failure" + when: fallback_result is failed and fallback_result.stdout == "" and fallback_result.stderr != "" + + - name: write error message to file + local_action: copy content="{{err_msg}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt" + when: fallback_result is failed and fallback_result.stdout == "" and fallback_result.stderr != "" + + - name: use result of swFallback as the result of Playbook + fail: + msg: "{{fallback_result.stderr}}" + when: fallback_result is failed