4 - name: create a temporary file for additional data
\r
6 path: /tmp/tmp-{{Id}}
\r
9 - name: prepare additional data
\r
10 shell: echo {{additionalData}} > /tmp/tmp-{{Id}}
\r
12 - name: execute pre-check operation
\r
13 shell: ./swm/upgrade-pre-check {{pnfId}} {{oldSwVersion}} {{targetSwVersion}} {{ruleName}} /tmp/tmp-{{Id}}
\r
15 register: precheck_result
\r
17 - name: write output to file
\r
18 local_action: copy content="{{precheck_result.stdout}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"
\r
19 when: precheck_result.stdout != ""
\r
21 - name: remove the temporary file
\r
23 path: /tmp/tmp-{{Id}}
\r
26 - name: build error message
\r
29 "reason": "{{precheck_result.stderr}}"
\r
31 when: precheck_result is failed and precheck_result.stdout == "" and precheck_result.stderr != ""
\r
33 - name: write error message to file
\r
34 local_action: copy content="{{err_msg}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"
\r
35 when: precheck_result is failed and precheck_result.stdout == "" and precheck_result.stderr != ""
\r
37 - name: use result of pre-check as the result of Playbook
\r
39 msg: "{{precheck_result.stderr}}"
\r
40 when: precheck_result is failed
\r