-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add scheduled_tasks role
- Loading branch information
Showing
10 changed files
with
187 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Ansible Role: scheduled_tasks | ||
|
||
## Description | ||
|
||
You can specify a list of Schedules Tasks to be created under Windows. | ||
|
||
## Role Variables | ||
|
||
### scheduled_tasks | ||
|
||
List of Schedules Tasks, the single parameters can be taken from the [documentation](https://docs.ansible.com/ansible/latest/modules/win_scheduled_task_module.html) of Ansible. | ||
|
||
#### Example | ||
|
||
```yml | ||
scheduled_tasks: | ||
- name: 'Chocolatey Packages upgrade' | ||
description: 'chocolatey upgrade all Packages evry Day at 12:00' | ||
actions: | ||
- path: powershell.exe | ||
working_directory: 'C:\Support\scripts\' | ||
arguments: '-ExecutionPolicy Bypass -File "C:\Support\scripts\Choco-Update.ps1"' | ||
triggers: | ||
- type: daily | ||
start_boundary: '2017-10-09T12:00:00' | ||
username: SYSTEM | ||
state: present | ||
enabled: true | ||
``` | ||
## Example Playbook | ||
```yml | ||
- hosts: all | ||
collections: | ||
- sbaerlocher.windows | ||
roles: | ||
- scheduled_tasks | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
# defaults file for scheduled_tasks | ||
|
||
# List of Schedules Tasks, the single parameters | ||
# can be taken from the documentation of Ansible. | ||
# https://docs.ansible.com/ansible/latest/modules/win_scheduled_task_module.html | ||
# | ||
# Example: | ||
# | ||
# scheduled_tasks: | ||
# - name: 'Chocolatey Packages upgrade' | ||
# description: 'chocolatey upgrade all Packages evry Day at 12:00' | ||
# actions: | ||
# - path: powershell.exe | ||
# working_directory: 'C:\Support\scripts\' | ||
# arguments: '-ExecutionPolicy Bypass -File "C:\Support\scripts\Choco-Update.ps1"' | ||
# triggers: | ||
# - type: daily | ||
# start_boundary: '2017-10-09T12:00:00' | ||
# username: SYSTEM | ||
# state: present | ||
# enabled: true | ||
# | ||
|
||
# scheduled_tasks: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
galaxy_info: | ||
author: Simon Baerlocher (https://sbaerlocher.ch) | ||
description: Create scheduled tasks. | ||
license: MIT | ||
min_ansible_version: 2.9 | ||
platforms: | ||
- name: Windows | ||
versions: | ||
- all | ||
|
||
galaxy_tags: | ||
- windows | ||
- scheduled_tasks | ||
|
||
dependencies: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
dependency: | ||
name: galaxy | ||
driver: | ||
name: docker | ||
lint: | ||
name: yamllint | ||
platforms: | ||
- name: instance | ||
image: 'geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest' | ||
command: ${MOLECULE_DOCKER_COMMAND:-""} | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:ro | ||
privileged: true | ||
pre_build_image: true | ||
scenario: | ||
name: default | ||
verifier: | ||
name: testinfra | ||
lint: | ||
name: flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
- name: Converge | ||
hosts: all | ||
roles: | ||
- role: sbaerlocher.windows.scheduled_tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
# tasks file for scheduled_tasks | ||
|
||
- name: 'include scheduled tasks' | ||
include_tasks: 'scheduled_task.yml' | ||
loop: '{{ scheduled_tasks }}' | ||
loop_control: | ||
loop_var: scheduled_task | ||
tags: | ||
- configuration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
# tasks file for scheduled_tasks | ||
|
||
- name: 'Create {{ scheduled_task.name }} scheduled task' | ||
win_scheduled_task: | ||
name: '{{ scheduled_task.name }}' | ||
description: '{{ scheduled_task.description | default(omit) }}' | ||
actions: '{{ scheduled_task.actions }}' | ||
allow_demand_start: '{{ scheduled_task.allow_demand_start | default(omit) }}' | ||
allow_hard_terminate: '{{ scheduled_task.allow_hard_terminate | default(omit) }}' | ||
author: '{{ scheduled_task.author | default(omit) }}' | ||
compatibility: '{{ scheduled_task.compatibility | default(omit) }}' | ||
date: '{{ scheduled_task.date | default(omit) }}' | ||
delete_expired_task_after: '{{ scheduled_task.delete_expired_task_after | default(omit) }}' | ||
disallow_start_if_on_batteries: '{{ scheduled_task.disallow_start_if_on_batteries | default(omit) }}' | ||
display_name: '{{ scheduled_task.display_name | default(omit) }}' | ||
enabled: '{{ scheduled_task.enabled | default(omit) }}' | ||
execution_time_limit: '{{ scheduled_task.execution_time_limit | default(omit) }}' | ||
group: '{{ scheduled_task.group | default(omit) }}' | ||
hidden: '{{ scheduled_task.delete_expired_task_after | default(omit) }}' | ||
logon_type: '{{ scheduled_task.logon_type | default(omit) }}' | ||
multiple_instances: '{{ scheduled_task.multiple_instances | default(omit) }}' | ||
password: '{{ scheduled_task.password| default(omit) }}' | ||
path: '{{ scheduled_task.path | default(omit) }}' | ||
priority: '{{ scheduled_task.priority | default(omit) }}' | ||
restart_count: '{{ scheduled_task.restart_count | default(omit) }}' | ||
run_level: '{{ scheduled_task.run_level | default(omit) }}' | ||
run_only_if_idle: '{{ scheduled_task.run_only_if_idle | default(omit) }}' | ||
run_only_if_network_available: '{{ scheduled_task.run_only_if_network_available | default(omit) }}' | ||
source: '{{ scheduled_task.source | default(omit) }}' | ||
start_when_available: '{{ scheduled_task.start_when_available | default(omit) }}' | ||
state: '{{ scheduled_task.state | default(omit) }}' | ||
stop_if_going_on_batteries: '{{ scheduled_task.stop_if_going_on_batteries | default(omit) }}' | ||
triggers: '{{ scheduled_task.triggers | default(omit) }}' | ||
update_password: '{{ scheduled_task.update_password | default(omit) }}' | ||
username: '{{ scheduled_task.username | default(omit) }}' | ||
version: '{{ scheduled_task.version | default(omit) }}' | ||
wake_to_run: '{{ scheduled_task.wake_to_run | default(omit) }}' |