1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/win_scheduled_task/tasks/main.yml
Dag Wieers 72e7927dd5 win_scheduled_task: Added frequency: once and check_mode support (#22611)
* win_scheduled_task: Added frequency: once and check_mode support

This patch includes:
- Renamed `execute:` parameter to `executable:`
- Renamed `argument:` parameter to `arguments:`
- Implemented `frequency: once` support
- Implemented check_mode support
- Fix idempotency issue related to empty description
- Added integration tests

* Improve the integration test structure

I think this is a great way to test normal mode and check-mode from the same playbook.

* Small fixes after review
2017-03-15 07:11:24 -07:00

46 lines
1.4 KiB
YAML

# NOTE: The win_scheduled_task module only works on Win2012+
- name: Test Windows capabilities
raw: Get-Command New-ScheduledTask -ErrorAction SilentlyContinue; $?
failed_when: no
register: new_scheduledtask
- name: Set boolean for capability
set_fact:
has_new_scheduledtask: '{{ new_scheduledtask.rc == 0 }}'
- name: Test in normal mode
when: has_new_scheduledtask
block:
- include: tests.yml
- name: Check the various tasks in normal mode
assert:
that:
- add_scheduled_task.changed == true
- add_scheduled_task.exists == false
- add_scheduled_task_again.changed == false
- add_scheduled_task_again.exists == true
- remove_scheduled_task.changed == true
- remove_scheduled_task.exists == true
- remove_scheduled_task_again.changed == false
- remove_scheduled_task_again.exists == false
- name: Test in check-mode
check_mode: yes
when: has_new_scheduledtask
block:
- include: tests.yml
- name: Check the various tests in check-mode
assert:
that:
- add_scheduled_task.changed == true
- add_scheduled_task.exists == false
- add_scheduled_task_again.changed == true
- add_scheduled_task_again.exists == false
- remove_scheduled_task.changed == false
- remove_scheduled_task.exists == false
- remove_scheduled_task_again.changed == false
- remove_scheduled_task_again.exists == false