2017-11-21 22:49:38 +01:00
|
|
|
---
|
|
|
|
- name: expect failure when state is not a valid option
|
|
|
|
win_updates:
|
|
|
|
state: invalid
|
|
|
|
register: invalid_state
|
2019-08-28 01:46:59 +02:00
|
|
|
failed_when: invalid_state.msg != 'state must be either installed, searched or downloaded'
|
2017-11-21 22:49:38 +01:00
|
|
|
|
|
|
|
- name: ensure log file not present before tests
|
|
|
|
win_file:
|
|
|
|
path: '{{win_updates_dir}}/update.log'
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
- name: search for updates without log output
|
|
|
|
win_updates:
|
|
|
|
state: searched
|
|
|
|
category_names:
|
|
|
|
- CriticalUpdates
|
|
|
|
register: update_search_without_log
|
|
|
|
|
|
|
|
- name: get stat of update without log file
|
|
|
|
win_stat:
|
|
|
|
path: '{{win_updates_dir}}/update.log'
|
|
|
|
register: update_search_without_log_actual
|
|
|
|
|
|
|
|
- name: assert search for updates without log output
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- not update_search_without_log is changed
|
|
|
|
- update_search_without_log.reboot_required == False
|
|
|
|
- update_search_without_log.updates is defined
|
|
|
|
- update_search_without_log.installed_update_count is defined
|
|
|
|
- update_search_without_log.found_update_count is defined
|
|
|
|
- update_search_without_log_actual.stat.exists == False
|
|
|
|
|
|
|
|
- name: search for updates with log output (check)
|
|
|
|
win_updates:
|
|
|
|
state: searched
|
2018-02-14 21:14:06 +01:00
|
|
|
category_names: CriticalUpdates
|
2017-11-21 22:49:38 +01:00
|
|
|
log_path: '{{win_updates_dir}}/update.log'
|
|
|
|
register: update_search_with_log_check
|
|
|
|
check_mode: yes
|
|
|
|
|
|
|
|
- name: get stat of update log file (check)
|
|
|
|
win_stat:
|
|
|
|
path: '{{win_updates_dir}}/update.log'
|
|
|
|
register: update_search_with_log_check_actual
|
|
|
|
|
|
|
|
- name: assert search for updates with log output
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- not update_search_with_log_check is changed
|
|
|
|
- update_search_with_log_check.reboot_required == False
|
|
|
|
- update_search_with_log_check.updates is defined
|
|
|
|
- update_search_with_log_check.installed_update_count is defined
|
|
|
|
- update_search_with_log_check.found_update_count is defined
|
|
|
|
- update_search_with_log_check_actual.stat.exists == False
|
|
|
|
|
2018-05-23 22:21:01 +02:00
|
|
|
- name: search for updates with log output and use scheduled task
|
2017-11-21 22:49:38 +01:00
|
|
|
win_updates:
|
|
|
|
state: searched
|
|
|
|
category_names:
|
|
|
|
- CriticalUpdates
|
|
|
|
log_path: '{{win_updates_dir}}/update.log'
|
2018-05-23 22:21:01 +02:00
|
|
|
use_scheduled_task: yes
|
2017-11-21 22:49:38 +01:00
|
|
|
register: update_search_with_log
|
|
|
|
|
|
|
|
- name: get stat of update log file
|
|
|
|
win_stat:
|
|
|
|
path: '{{win_updates_dir}}/update.log'
|
|
|
|
register: update_search_with_log_actual
|
|
|
|
|
|
|
|
- name: assert search for updates with log output
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- not update_search_with_log is changed
|
|
|
|
- update_search_with_log.reboot_required == False
|
|
|
|
- update_search_with_log.updates is defined
|
|
|
|
- update_search_with_log.installed_update_count is defined
|
|
|
|
- update_search_with_log.found_update_count is defined
|
|
|
|
- update_search_with_log_actual.stat.exists
|
|
|
|
|
|
|
|
- name: ensure WUA service is stopped for tests
|
|
|
|
win_service:
|
|
|
|
name: wuauserv
|
|
|
|
state: stopped
|
|
|
|
start_mode: disabled
|
|
|
|
|
|
|
|
- name: expect failed when running with stopped WUA service
|
|
|
|
win_updates:
|
|
|
|
state: searched
|
|
|
|
category_names:
|
|
|
|
- CriticalUpdates
|
|
|
|
register: update_service_stopped_failed
|
|
|
|
failed_when:
|
|
|
|
- "'Failed to search for updates with criteria' not in update_service_stopped_failed.msg"
|
|
|
|
- "'The service cannot be started' not in update_service_stopped_failed.msg"
|