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
This commit is contained in:
Dag Wieers 2017-03-15 15:11:24 +01:00 committed by Matt Davis
parent 34498590e3
commit 72e7927dd5
5 changed files with 149 additions and 82 deletions

View file

@ -41,7 +41,6 @@ options:
description:
description:
- The description for the scheduled task
required: false
enabled:
description:
- Enable/disable the task
@ -59,30 +58,27 @@ options:
user:
description:
- User to run scheduled task as
required: false
execute:
executable:
description:
- Command the scheduled task should execute
required: false
argument:
aliases: [ execute ]
arguments:
description:
- Arguments to provide scheduled task action
required: false
aliases: [ argument ]
frequency:
description:
- The frequency of the command, not idempotent
required: false
choices:
- once
- daily
- weekly
time:
description:
- Time to execute scheduled task, not idempotent
required: false
days_of_week:
description:
- Days of the week to run a weekly task, not idempotent
required: false
path:
description:
- Task folder in which this task will be stored
@ -93,12 +89,13 @@ EXAMPLES = r'''
# Create a scheduled task to open a command prompt
- win_scheduled_task:
name: TaskName
execute: cmd
frequency: daily
time: 9am
description: open command prompt
executable: cmd
arguments: -opt1 -opt2
path: example
enable: yes
time: 9am
frequency: daily
state: present
enabled: yes
user: SYSTEM
'''