-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy path_80_parse_output2.yml
56 lines (43 loc) · 1.2 KB
/
_80_parse_output2.yml
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
- hosts: all
tasks:
- name: Copy a single file
win_copy:
src: "{{ playbook_dir }}/files/test_output2.ps1"
dest: C:\Temp\test_output2.ps1
- name: Run a script
win_shell: C:\temp\test_output2.ps1
register: result2
- name: Process win_shell output
set_fact:
vm: "{{ result2.stdout | from_json }}"
- name: Debug VM properties
debug:
msg: VM {{ vm.name }} has IP Address {{ vm.ipAddress }}
- name: Set vm type
set_fact:
vm_type: "{{ vm | type_debug }}"
- name: Debug vm dict
debug:
msg: "Display this when dict"
when: vm_type == 'list'
- name: Copy a single file
win_copy:
src: "{{ playbook_dir }}/files/test_output3.ps1"
dest: C:\Temp\test_output3.ps1
- name: Run a script
win_shell: C:\temp\test_output3.ps1
register: result3
- name: Process win_shell output
set_fact:
vm2: "{{ result3.stdout | from_json }}"
- name: Set vm2 type
set_fact:
vm2_type: "{{ vm2 | type_debug }}"
- name: Debug vm dict
debug:
msg: "Display this when list"
when: vm2_type == 'list'
# - name: Debug VM properties
# debug:
# msg: VM {{ vm.name }} has IP Address {{ vm.ipAddress }}