Build Windows Templates in RHV
This commit is contained in:
43
roles/oatakan.windows_update/tasks/updates-all.yml
Normal file
43
roles/oatakan.windows_update/tasks/updates-all.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
|
||||
- name: check for available updates
|
||||
win_updates:
|
||||
category_names: "{{ win_update_category_names }}"
|
||||
blacklist: "{{ win_update_blacklist | default(omit) }}"
|
||||
state: searched
|
||||
register: available_updates
|
||||
|
||||
- debug:
|
||||
msg: |
|
||||
{{ inventory_hostname }} has {{ available_updates.found_update_count }} updates available.
|
||||
{% for key, value in available_updates.updates.items() %}
|
||||
- {{ value.title }}
|
||||
{% endfor %}
|
||||
when: available_updates.updates is defined
|
||||
|
||||
- include_tasks: updates-with-retry.yml
|
||||
when:
|
||||
- available_updates.updates is defined
|
||||
- available_updates.found_update_count > 0
|
||||
|
||||
- name: check for missing updates.
|
||||
win_updates:
|
||||
state: searched
|
||||
register: available_updates
|
||||
|
||||
- name: list missing updates
|
||||
debug:
|
||||
var: available_updates
|
||||
|
||||
- name: check to see if update is finished
|
||||
win_shell: gwmi -Class win32_computersystem -ComputerName 127.0.0.1 | select -ExpandProperty username -ErrorAction Stop
|
||||
register: logon_status
|
||||
until: logon_status is success
|
||||
delay: 10
|
||||
retries: 100
|
||||
ignore_errors: yes
|
||||
when: "'Server' not in ansible_distribution"
|
||||
|
||||
- name: reboot windows
|
||||
win_reboot:
|
||||
when: "'Server' not in ansible_distribution"
|
||||
Reference in New Issue
Block a user