5 - name: compatible with parameter targetSwVersion
\r
7 sw_to_be_downloaded: "{{targetSwVersion}}"
\r
8 when: targetSwVersion is defined
\r
10 - name: support new 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: pnfId is defined
\r
20 - name: support new parameter neIdentifier
\r
22 ne_identifier: "{{neIdentifier}}"
\r
23 when: neIdentifier is defined
\r
25 - name: support new parameter swToBeInstalled
\r
27 sw_to_be_installed: "{{swToBeInstalled}}"
\r
28 when: swToBeInstalled is defined
\r
30 - name: check if swToBeInstalled is empty
\r
32 when: swToBeInstalled is defined and sw_to_be_installed | length == 0
\r
34 - name: support new parameter swVersionToBeActivated
\r
36 sw_version_to_be_activated: "{{swVersionToBeActivated}}"
\r
37 when: swVersionToBeActivated is defined
\r
39 - name: execute downloadNESw operation
\r
40 shell: ./swm/downloadNESw --swToBeDownloaded {{sw_to_be_downloaded}} --neIdentifier {{ne_identifier}}
\r
41 register: download_result
\r
43 - name: parse response of downloadNESw
\r
45 download_response: "{{ download_result.stdout | from_json }}"
\r
46 when: swToBeInstalled is not defined
\r
48 - name: fetch file of Notification notifyDownloadNESwStatusChanged
\r
50 dest: "{{inventory_dir}}"
\r
51 src: "/tmp/notifyDownloadNESwStatusChanged-{{download_response.downloadProcessId}}"
\r
52 when: swToBeInstalled is not defined
\r
54 - name: read contents of Notification notifyDownloadNESwStatusChanged
\r
56 download_notification: "{{ lookup('file', '{{inventory_dir}}/{{inventory_hostname}}/tmp/notifyDownloadNESwStatusChanged-{{download_response.downloadProcessId}}') | from_json }}"
\r
57 when: swToBeInstalled is not defined
\r
59 - name: delete file of Notification notifyDownloadNESwStatusChanged
\r
60 local_action: file path="{{inventory_dir}}/{{inventory_hostname}}/tmp/notifyDownloadNESwStatusChanged-{{download_response.downloadProcessId}}" state=absent
\r
61 when: swToBeInstalled is not defined
\r
63 - name: set downloadedNESwInfo
\r
65 downloaded_ne_sw_info: "{{ download_notification.downloadedNESwInfo }}"
\r
66 when: swToBeInstalled is not defined
\r
68 - name: execute installNESw operation
\r
69 shell: ./swm/installNESw --swToBeInstalled {{item}} --neIdentifier {{ne_identifier}}
\r
70 register: install_result
\r
71 with_items: "{{ downloaded_ne_sw_info | default([]) }}"
\r
73 - name: execute installNESw operation using new parameter
\r
74 shell: ./swm/installNESw --swToBeInstalled {{item}} --neIdentifier {{ne_identifier}}
\r
75 register: install_result_new
\r
76 with_items: "{{ sw_to_be_installed | default([]) }}"
\r
78 - name: unify install result
\r
80 install_result: "{{ install_result_new }}"
\r
81 when: swToBeInstalled is defined
\r
83 - name: set install results list
\r
85 install_results_list: "{{ install_result.results }}"
\r
86 when: swVersionToBeActivated is not defined
\r
88 - name: parse responses of all the installNESws
\r
90 install_responses: "{{ install_responses | default([]) + [item.stdout | from_json] }}"
\r
91 with_items: "{{ install_results_list | default([]) }}"
\r
93 - name: fetch files of all the Notifications notifyInstallNESwStatusChanged
\r
95 dest: "{{inventory_dir}}"
\r
96 src: "/tmp/notifyInstallNESwStatusChanged-{{item.installProcessId}}"
\r
97 with_items: "{{ install_responses | default([]) }}"
\r
99 - name: read contents of all the Notifications notifyInstallNESwStatusChanged
\r
101 install_notifications: "{{ install_notifications | default([]) + [lookup('file', '{{inventory_dir}}/{{inventory_hostname}}/tmp/notifyInstallNESwStatusChanged-{{item.installProcessId}}') | from_json] }}"
\r
102 with_items: "{{ install_responses | default([]) }}"
\r
104 - name: delete files of all the Notifications notifyInstallNESwStatusChanged
\r
105 local_action: file path="{{inventory_dir}}/{{inventory_hostname}}/tmp/notifyInstallNESwStatusChanged-{{item.installProcessId}}" state=absent
\r
106 with_items: "{{ install_responses | default([]) }}"
\r
108 - name: parse all the installed NE SW info
\r
110 installed_ne_sw_info: "{{ installed_ne_sw_info | default([]) + item.installedNESwInfo }}"
\r
111 with_items: "{{ install_notifications | default([]) }}"
\r
113 - name: execute activateNESw operation
\r
114 shell: ./swm/activateNESw --swVersionToBeActivated {{item}} --neIdentifier {{ne_identifier}}
\r
115 register: activate_result
\r
116 with_items: "{{ installed_ne_sw_info | default([]) }}"
\r
118 - name: execute activateNESw operation using new parameter
\r
119 shell: ./swm/activateNESw --swVersionToBeActivated {{sw_version_to_be_activated}} --neIdentifier {{ne_identifier}}
\r
120 register: activate_result_new
\r
121 when: swVersionToBeActivated is defined
\r
123 - name: unify activate result
\r
125 activate_result: "{{ activate_result_new }}"
\r
126 when: swVersionToBeActivated is defined
\r