ad4edf51a3098cefc8a00f2a2e2edfaa4d189eff
[sdnc/oam.git] / installation / ansible-server / src / main / Playbooks / ansible_huawei_postcheck@0.01.yml
1 ---\r
2 - hosts: all\r
3   tasks:\r
4   - name: create a temporary file for additional data\r
5     file: \r
6         path: /tmp/tmp-{{Id}}\r
7         state: touch\r
8     become: false\r
9 \r
10   - name: prepare additional data\r
11     shell: echo {{additionalData}} > /tmp/tmp-{{Id}}\r
12     become: false\r
13 \r
14   - name: execute post-check operation\r
15     shell: ./swm/upgrade-post-check {{pnfId}} {{oldSwVersion}} {{targetSwVersion}} {{ruleName}} /tmp/tmp-{{Id}}\r
16     ignore_errors: yes\r
17     register: postcheck_result\r
18 \r
19   - name: write output to file\r
20     local_action: copy content="{{postcheck_result.stdout}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"\r
21     when: postcheck_result.stdout != ""\r
22 \r
23   - name: remove the temporary file\r
24     file:\r
25         path: /tmp/tmp-{{Id}}\r
26         state: absent\r
27     become: false\r
28 \r
29   - name: use result of post-check as the result of Playbook\r
30     fail:\r
31       msg: "{{postcheck_result.stderr}}"\r
32     when: postcheck_result is failed\r
33 \r