From 83ff8436156f3f976eff2633b0c54b9426d11a25 Mon Sep 17 00:00:00 2001 From: Enbo Wang Date: Fri, 10 May 2019 10:04:18 +0000 Subject: Fix missing payload for DGs and Playbooks of SW upgrade Change-Id: I89a118ef1e05c76800d6c2fa640dc3dcf2d78fca Issue-ID: SDNC-733 Signed-off-by: Enbo Wang Former-commit-id: 4ca9a8ea6cebfad2e3f423b90df187bcbc51a67b --- .../Playbooks/ansible_huawei_postcheck@0.01.yml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'installation/ansible-server/src/main/Playbooks/ansible_huawei_postcheck@0.01.yml') diff --git a/installation/ansible-server/src/main/Playbooks/ansible_huawei_postcheck@0.01.yml b/installation/ansible-server/src/main/Playbooks/ansible_huawei_postcheck@0.01.yml index ad4edf51..b9b1ab81 100644 --- a/installation/ansible-server/src/main/Playbooks/ansible_huawei_postcheck@0.01.yml +++ b/installation/ansible-server/src/main/Playbooks/ansible_huawei_postcheck@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 post-check operation shell: ./swm/upgrade-post-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": "{{postcheck_result.stderr}}" + "result": "Failure" + when: postcheck_result is failed and postcheck_result.stdout == "" and postcheck_result.stderr != "" + + - name: write error message to file + local_action: copy content="{{err_msg}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt" + when: postcheck_result is failed and postcheck_result.stdout == "" and postcheck_result.stderr != "" - name: use result of post-check as the result of Playbook fail: -- cgit 1.2.3-korg