-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAzure_StackHCI_Get_Updates.yml
More file actions
62 lines (51 loc) · 1.78 KB
/
Copy pathAzure_StackHCI_Get_Updates.yml
File metadata and controls
62 lines (51 loc) · 1.78 KB
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
57
58
59
60
61
62
---
- name: Get Stack HCI Configuration and Updates
hosts: all
gather_facts: no
tasks:
- name: Check if the server is online
ansible.windows.win_ping:
register: ping_result
- name: Print the ping result
debug:
var: ping_result
- name: Copy Script 1 to the host
ansible.windows.win_copy:
src: ./Script.ps1
dest: C:\Temp\Script.ps1
when: ping_result.ping == "pong"
- name: Copy Script 2 to the host
ansible.windows.win_copy:
src: ./GetHCIAKSconfig.ps1
dest: C:\Temp\GetHCIAKSconfig.ps1
when: ping_result.ping == "pong"
- name: Get the list of updates for the StackHCI
ansible.windows.win_shell: "powershell C:\\Temp\\Script.ps1 -username {{ username }} -password {{ password }}"
when: ping_result.ping == "pong"
- name: Get configuration for the StackHCI
ansible.windows.win_shell: "powershell C:\\Temp\\GetHCIAKSconfig.ps1 -username {{ username }} -password {{ password }}"
when: ping_result.ping == "pong"
- name: Read updates status
ansible.windows.win_shell: 'type C:\\Temp\\updateresult.txt'
register: updates_status
when: ping_result.ping == "pong"
- name: Read configuration status
ansible.windows.win_shell: 'type C:\\Temp\\configresult.txt'
register: config_status
when: ping_result.ping == "pong"
- name: Print the updates status
debug:
var: updates_status.stdout_lines
- name: Print the configuration status
debug:
var: config_status.stdout_lines
- name: Remove a file, if present
ansible.windows.win_file:
path: "{{ item }}"
state: absent
with_items:
- "C:\\Temp\\configresult.txt"
- "C:\\Temp\\updateresult.txt"
- "C:\\Temp\\Script.ps1"
- "C:\\Temp\\GetHCIAKSconfig.ps1"
when: ping_result.ping == "pong"