X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=installation%2Fansible-server%2Fsrc%2Fmain%2FPlaybooks%2Fansible_huawei_precheck%400.01.yml;h=dcb6f6a01aabd0049783517bfe2a8ea63f115bc7;hb=83ff8436156f3f976eff2633b0c54b9426d11a25;hp=668ed7d034c8255cf0ac88576b821b08185b9783;hpb=d7dc8f2552565790223112996c9bfc719a55c0d8;p=sdnc%2Foam.git diff --git a/installation/ansible-server/src/main/Playbooks/ansible_huawei_precheck@0.01.yml b/installation/ansible-server/src/main/Playbooks/ansible_huawei_precheck@0.01.yml index 668ed7d0..dcb6f6a0 100644 --- a/installation/ansible-server/src/main/Playbooks/ansible_huawei_precheck@0.01.yml +++ b/installation/ansible-server/src/main/Playbooks/ansible_huawei_precheck@0.01.yml @@ -3,13 +3,11 @@ tasks: - name: create a temporary file for additional data file: - path: /tmp/tmp-{{Id}} - state: touch - become: false + path: /tmp/tmp-{{Id}} + state: touch - name: prepare additional data shell: echo {{additionalData}} > /tmp/tmp-{{Id}} - become: false - name: execute pre-check operation shell: ./swm/upgrade-pre-check {{pnfId}} {{oldSwVersion}} {{targetSwVersion}} {{ruleName}} /tmp/tmp-{{Id}} @@ -22,9 +20,19 @@ - name: remove the temporary file file: - path: /tmp/tmp-{{Id}} - state: absent - become: false + path: /tmp/tmp-{{Id}} + state: absent + + - name: build error message + set_fact: + err_msg: + "reason": "{{precheck_result.stderr}}" + "result": "Failure" + when: precheck_result is failed and precheck_result.stdout == "" and precheck_result.stderr != "" + + - name: write error message to file + local_action: copy content="{{err_msg}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt" + when: precheck_result is failed and precheck_result.stdout == "" and precheck_result.stderr != "" - name: use result of pre-check as the result of Playbook fail: