aboutsummaryrefslogtreecommitdiffstats
path: root/installation/ansible-server/src
diff options
context:
space:
mode:
authorEnbo Wang <wangenbo@huawei.com>2019-04-19 11:09:15 +0000
committerEnbo Wang <wangenbo@huawei.com>2019-04-19 11:43:59 +0000
commite5aea0d8f2ca5c50cf65a2bfad92d2522743fcbf (patch)
treea74cc0c5d705ebfbb7efb13eb4c04e28bdce2e8f /installation/ansible-server/src
parentd6f5a348861c0becfdababee3eaa7ff99240fe5f (diff)
Add missing payload for DGs and Playbooks of LCM APIs
Add missing payload for DGs and Playbooks of LCM:rollback, LCM:upgrade-pre-check and LCM:upgrade-post-check. Change-Id: I96d8d86af1200843f85b9ee8a0cc8abf6a0b8ec8 Issue-ID: SDNC-733 Signed-off-by: Enbo Wang <wangenbo@huawei.com> Former-commit-id: 681d674c31d356fb46fa8301219878619185b68b
Diffstat (limited to 'installation/ansible-server/src')
-rw-r--r--installation/ansible-server/src/main/Playbooks/ansible_huawei_postcheck@0.01.yml33
-rw-r--r--installation/ansible-server/src/main/Playbooks/ansible_huawei_precheck@0.01.yml33
-rw-r--r--installation/ansible-server/src/main/Playbooks/ansible_huawei_rollback@0.00.yml14
3 files changed, 78 insertions, 2 deletions
diff --git a/installation/ansible-server/src/main/Playbooks/ansible_huawei_postcheck@0.01.yml b/installation/ansible-server/src/main/Playbooks/ansible_huawei_postcheck@0.01.yml
new file mode 100644
index 00000000..ad4edf51
--- /dev/null
+++ b/installation/ansible-server/src/main/Playbooks/ansible_huawei_postcheck@0.01.yml
@@ -0,0 +1,33 @@
+---
+- hosts: all
+ tasks:
+ - name: create a temporary file for additional data
+ file:
+ path: /tmp/tmp-{{Id}}
+ state: touch
+ become: false
+
+ - name: prepare additional data
+ shell: echo {{additionalData}} > /tmp/tmp-{{Id}}
+ become: false
+
+ - name: execute post-check operation
+ shell: ./swm/upgrade-post-check {{pnfId}} {{oldSwVersion}} {{targetSwVersion}} {{ruleName}} /tmp/tmp-{{Id}}
+ ignore_errors: yes
+ register: postcheck_result
+
+ - name: write output to file
+ local_action: copy content="{{postcheck_result.stdout}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"
+ when: postcheck_result.stdout != ""
+
+ - name: remove the temporary file
+ file:
+ path: /tmp/tmp-{{Id}}
+ state: absent
+ become: false
+
+ - name: use result of post-check as the result of Playbook
+ fail:
+ msg: "{{postcheck_result.stderr}}"
+ when: postcheck_result is failed
+
diff --git a/installation/ansible-server/src/main/Playbooks/ansible_huawei_precheck@0.01.yml b/installation/ansible-server/src/main/Playbooks/ansible_huawei_precheck@0.01.yml
new file mode 100644
index 00000000..668ed7d0
--- /dev/null
+++ b/installation/ansible-server/src/main/Playbooks/ansible_huawei_precheck@0.01.yml
@@ -0,0 +1,33 @@
+---
+- hosts: all
+ tasks:
+ - name: create a temporary file for additional data
+ file:
+ path: /tmp/tmp-{{Id}}
+ state: touch
+ become: false
+
+ - name: prepare additional data
+ shell: echo {{additionalData}} > /tmp/tmp-{{Id}}
+ become: false
+
+ - name: execute pre-check operation
+ shell: ./swm/upgrade-pre-check {{pnfId}} {{oldSwVersion}} {{targetSwVersion}} {{ruleName}} /tmp/tmp-{{Id}}
+ ignore_errors: yes
+ register: precheck_result
+
+ - name: write output to file
+ local_action: copy content="{{precheck_result.stdout}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"
+ when: precheck_result.stdout != ""
+
+ - name: remove the temporary file
+ file:
+ path: /tmp/tmp-{{Id}}
+ state: absent
+ become: false
+
+ - name: use result of pre-check as the result of Playbook
+ fail:
+ msg: "{{precheck_result.stderr}}"
+ when: precheck_result is failed
+
diff --git a/installation/ansible-server/src/main/Playbooks/ansible_huawei_rollback@0.00.yml b/installation/ansible-server/src/main/Playbooks/ansible_huawei_rollback@0.00.yml
index 0d20bc3e..fa164c9c 100644
--- a/installation/ansible-server/src/main/Playbooks/ansible_huawei_rollback@0.00.yml
+++ b/installation/ansible-server/src/main/Playbooks/ansible_huawei_rollback@0.00.yml
@@ -3,6 +3,16 @@
tasks:
- name: execute swFallback operation
- shell: ./swm/swFallback.sh --filter {{filter}}
- register: fallback__result
+ shell: ./swm/swFallback --filter {{filter}}
+ ignore_errors: yes
+ register: fallback_result
+
+ - name: write output to file
+ local_action: copy content="{{fallback_result.stdout}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"
+ when: fallback_result.stdout != ""
+
+ - name: use result of swFallback as the result of Playbook
+ fail:
+ msg: "{{fallback_result.stderr}}"
+ when: fallback_result is failed