aboutsummaryrefslogtreecommitdiffstats
path: root/installation/ansible-server/src/main/Playbooks/ansible_huawei_precheck@0.01.yml
diff options
context:
space:
mode:
Diffstat (limited to 'installation/ansible-server/src/main/Playbooks/ansible_huawei_precheck@0.01.yml')
-rw-r--r--installation/ansible-server/src/main/Playbooks/ansible_huawei_precheck@0.01.yml33
1 files changed, 33 insertions, 0 deletions
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
+