2015-05-01 20:17:34 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# This file is part of Ansible
|
|
|
|
#
|
|
|
|
# Ansible is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# Ansible is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
# this is a windows documentation stub. actual code lives in the .ps1
|
|
|
|
# file of the same name
|
|
|
|
|
2017-03-14 16:07:22 +00:00
|
|
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
|
|
|
'status': ['preview'],
|
|
|
|
'supported_by': 'community'}
|
|
|
|
|
2016-12-06 10:35:25 +00:00
|
|
|
|
2017-01-19 01:57:33 +00:00
|
|
|
DOCUMENTATION = r'''
|
2015-05-01 20:17:34 +00:00
|
|
|
---
|
|
|
|
module: win_scheduled_task
|
2017-03-09 16:20:25 +00:00
|
|
|
author: "Peter Mounce"
|
2015-05-06 20:47:39 +00:00
|
|
|
version_added: "2.0"
|
2015-05-01 20:17:34 +00:00
|
|
|
short_description: Manage scheduled tasks
|
|
|
|
description:
|
|
|
|
- Manage scheduled tasks
|
2016-03-10 18:41:04 +00:00
|
|
|
notes:
|
|
|
|
- This module requires Windows Server 2012 or later.
|
2015-05-01 20:17:34 +00:00
|
|
|
options:
|
|
|
|
name:
|
|
|
|
description:
|
|
|
|
- Name of the scheduled task
|
|
|
|
required: true
|
2016-12-08 05:34:16 +00:00
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- The description for the scheduled task
|
2015-05-19 10:21:23 +00:00
|
|
|
enabled:
|
2015-05-01 20:17:34 +00:00
|
|
|
description:
|
2015-06-30 17:06:16 +00:00
|
|
|
- Enable/disable the task
|
2015-05-01 20:17:34 +00:00
|
|
|
choices:
|
2015-05-19 10:21:23 +00:00
|
|
|
- yes
|
|
|
|
- no
|
|
|
|
default: yes
|
2015-06-30 17:06:16 +00:00
|
|
|
state:
|
|
|
|
description:
|
|
|
|
- State that the task should become
|
2016-12-08 05:34:16 +00:00
|
|
|
required: true
|
2015-06-30 17:06:16 +00:00
|
|
|
choices:
|
|
|
|
- present
|
|
|
|
- absent
|
2016-12-08 05:34:16 +00:00
|
|
|
user:
|
|
|
|
description:
|
|
|
|
- User to run scheduled task as
|
2017-03-15 14:11:24 +00:00
|
|
|
executable:
|
2015-06-30 17:06:16 +00:00
|
|
|
description:
|
|
|
|
- Command the scheduled task should execute
|
2017-03-15 14:11:24 +00:00
|
|
|
aliases: [ execute ]
|
|
|
|
arguments:
|
2016-12-08 05:34:16 +00:00
|
|
|
description:
|
|
|
|
- Arguments to provide scheduled task action
|
2017-03-15 14:11:24 +00:00
|
|
|
aliases: [ argument ]
|
2015-06-30 17:06:16 +00:00
|
|
|
frequency:
|
|
|
|
description:
|
2015-09-08 19:40:21 +00:00
|
|
|
- The frequency of the command, not idempotent
|
2015-06-30 17:06:16 +00:00
|
|
|
choices:
|
2017-03-15 14:11:24 +00:00
|
|
|
- once
|
2015-06-30 17:06:16 +00:00
|
|
|
- daily
|
|
|
|
- weekly
|
|
|
|
time:
|
|
|
|
description:
|
2015-09-08 19:40:21 +00:00
|
|
|
- Time to execute scheduled task, not idempotent
|
2016-12-08 05:34:16 +00:00
|
|
|
days_of_week:
|
2015-07-07 16:55:46 +00:00
|
|
|
description:
|
2015-09-08 19:40:21 +00:00
|
|
|
- Days of the week to run a weekly task, not idempotent
|
2015-06-30 17:06:16 +00:00
|
|
|
path:
|
|
|
|
description:
|
2017-06-14 07:02:36 +00:00
|
|
|
- Task folder in which this task will be stored - creates a non-existent path when C(state) is C(present),
|
|
|
|
and removes an empty path when C(state) is C(absent)
|
2015-06-30 17:06:16 +00:00
|
|
|
default: '\'
|
2015-05-01 20:17:34 +00:00
|
|
|
'''
|
|
|
|
|
2017-01-19 01:57:33 +00:00
|
|
|
EXAMPLES = r'''
|
2016-12-01 17:39:49 +00:00
|
|
|
# Create a scheduled task to open a command prompt
|
|
|
|
- win_scheduled_task:
|
|
|
|
name: TaskName
|
|
|
|
description: open command prompt
|
2017-03-15 14:11:24 +00:00
|
|
|
executable: cmd
|
|
|
|
arguments: -opt1 -opt2
|
2017-06-14 07:02:36 +00:00
|
|
|
path: \example
|
2017-03-15 14:11:24 +00:00
|
|
|
time: 9am
|
|
|
|
frequency: daily
|
2016-12-01 17:39:49 +00:00
|
|
|
state: present
|
2017-03-15 14:11:24 +00:00
|
|
|
enabled: yes
|
2016-12-01 17:39:49 +00:00
|
|
|
user: SYSTEM
|
2015-05-01 20:17:34 +00:00
|
|
|
'''
|