blob: 668ed7d034c8255cf0ac88576b821b08185b9783 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
|