5 - name: parameter neIdentifier
\r
7 ne_identifier: "{{neIdentifier}}"
\r
8 when: neIdentifier is defined
\r
10 - name: parameter swToBeDownloaded
\r
12 sw_to_be_downloaded: "{{swToBeDownloaded}}"
\r
13 when: swToBeDownloaded is defined
\r
15 - name: compatible with parameter pnfId
\r
17 ne_identifier: "{{pnfId}}"
\r
18 when: neIdentifier is not defined and pnfId is defined
\r
20 - name: execute downloadNESw operation
\r
21 shell: ./swm/downloadNESw --neIdentifier {{ne_identifier}} --swToBeDownloaded {{sw_to_be_downloaded}}
\r
23 register: download_result
\r
25 - name: parse response of downloadNESw
\r
27 download_response: "{{ download_result.stdout | from_json }}"
\r
29 - name: build failure message
\r
31 download_failure_msg: "{{ download_result.stdout }}"
\r
32 when: download_result is failed
\r
34 - name: write failure message to file
\r
35 local_action: copy content="{{download_failure_msg}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"
\r
36 when: download_result is failed
\r
38 - name: use result of downloadNESw as the result of Playbook
\r
40 msg: "{{download_failure_msg}}"
\r
41 when: download_result is failed
\r
43 - name: fetch file of Notification notifyDownloadNESwStatusChanged
\r
45 dest: "{{inventory_dir}}"
\r
46 src: "/tmp/notifyDownloadNESwStatusChanged-{{download_response.downloadProcessId}}"
\r
48 - name: read contents of Notification notifyDownloadNESwStatusChanged
\r
50 download_notification: "{{ lookup('file', '{{inventory_dir}}/{{inventory_hostname}}/tmp/notifyDownloadNESwStatusChanged-{{download_response.downloadProcessId}}') | from_json }}"
\r
52 - name: delete file of Notification notifyDownloadNESwStatusChanged
\r
53 local_action: file path="{{inventory_dir}}/{{inventory_hostname}}/tmp/notifyDownloadNESwStatusChanged-{{download_response.downloadProcessId}}" state=absent
\r
55 - name: build success message
\r
57 download_success_msg:
\r
59 when: download_notification.downloadOperationStatus == "NE_SWDOWNLOAD_SUCCESSFUL"
\r
61 - name: write success message to file
\r
62 local_action: copy content="{{download_success_msg}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"
\r
63 when: download_notification.downloadOperationStatus == "NE_SWDOWNLOAD_SUCCESSFUL"
\r