668ed7d034c8255cf0ac88576b821b08185b9783
[sdnc/oam.git] / installation / ansible-server / src / main / Playbooks / ansible_huawei_precheck@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 pre-check operation\r
15     shell: ./swm/upgrade-pre-check {{pnfId}} {{oldSwVersion}} {{targetSwVersion}} {{ruleName}} /tmp/tmp-{{Id}}\r
16     ignore_errors: yes\r
17     register: precheck_result\r
18 \r
19   - name: write output to file\r
20     local_action: copy content="{{precheck_result.stdout}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"\r
21     when: precheck_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 pre-check as the result of Playbook\r
30     fail:\r
31       msg: "{{precheck_result.stderr}}"\r
32     when: precheck_result is failed\r
33 \r