mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
441 lines
13 KiB
YAML
441 lines
13 KiB
YAML
7 years ago
|
---
|
||
|
- name: create task (check mode)
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
state: present
|
||
|
actions:
|
||
|
- path: cmd.exe
|
||
|
arguments: /c echo hi
|
||
|
description: Original Description
|
||
|
register: create_task_check
|
||
|
check_mode: yes
|
||
|
|
||
|
- name: get result of create task (check mode)
|
||
|
test_task_stat:
|
||
|
path: \
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
register: create_task_result_check
|
||
|
|
||
|
- name: assert results of create task (check mode)
|
||
|
assert:
|
||
|
that:
|
||
|
- create_task_check|changed
|
||
|
- create_task_result_check.task_exists == False
|
||
|
|
||
|
- name: create task
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
state: present
|
||
|
actions:
|
||
|
- path: cmd.exe
|
||
|
arguments: /c echo hi
|
||
|
description: Original Description
|
||
|
register: create_task
|
||
|
|
||
|
- name: get result of create task
|
||
|
test_task_stat:
|
||
|
path: \
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
register: create_task_result
|
||
|
|
||
|
- name: assert results of create task
|
||
|
assert:
|
||
|
that:
|
||
|
- create_task|changed
|
||
|
- create_task_result.task_exists == True
|
||
|
- create_task_result.task.actions|count == 1
|
||
|
- create_task_result.task.actions[0].Path == "cmd.exe"
|
||
|
- create_task_result.task.actions[0].Arguments == "/c echo hi"
|
||
|
- create_task_result.task.actions[0].WorkingDirectory == None
|
||
|
- create_task_result.task.registration_info.Description == "Original Description"
|
||
|
- create_task_result.task.triggers|count == 0
|
||
|
|
||
|
- name: create task (idempotent)
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
state: present
|
||
|
actions:
|
||
|
- path: cmd.exe
|
||
|
arguments: /c echo hi
|
||
|
description: Original Description
|
||
|
register: create_task_again
|
||
|
|
||
|
- name: assert results of create task (idempotent)
|
||
|
assert:
|
||
|
that:
|
||
|
- not create_task_again|changed
|
||
|
|
||
|
- name: change task (check mode)
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
state: present
|
||
|
author: Cow Inc.
|
||
|
description: Test for Ansible
|
||
|
allow_demand_start: no
|
||
|
restart_count: 5
|
||
|
restart_interval: PT2H5M
|
||
|
register: change_task_check
|
||
|
check_mode: yes
|
||
|
|
||
|
- name: get result of change task (check mode)
|
||
|
test_task_stat:
|
||
|
path: \
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
register: change_task_result_check
|
||
|
|
||
|
- name: assert results of change task (check mode)
|
||
|
assert:
|
||
|
that:
|
||
|
- change_task_check|changed
|
||
|
- change_task_result_check.task.actions|count == 1
|
||
|
- change_task_result_check.task.registration_info.Author == None
|
||
|
- change_task_result_check.task.registration_info.Description == "Original Description"
|
||
|
- change_task_result_check.task.settings.AllowDemandStart == true
|
||
|
- change_task_result_check.task.settings.RestartCount == 0
|
||
|
- change_task_result_check.task.settings.RestartInterval == None
|
||
|
|
||
|
- name: change task
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
state: present
|
||
|
author: Cow Inc.
|
||
|
description: Test for Ansible
|
||
|
allow_demand_start: no
|
||
|
restart_count: 5
|
||
|
restart_interval: PT1M
|
||
|
register: change_task
|
||
|
|
||
|
- name: get result of change task
|
||
|
test_task_stat:
|
||
|
path: \
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
register: change_task_result
|
||
|
|
||
|
- name: assert results of change task
|
||
|
assert:
|
||
|
that:
|
||
|
- change_task|changed
|
||
|
- change_task_result.task.actions|count == 1
|
||
|
- change_task_result.task.registration_info.Author == "Cow Inc."
|
||
|
- change_task_result.task.registration_info.Description == "Test for Ansible"
|
||
|
- change_task_result.task.settings.AllowDemandStart == false
|
||
|
- change_task_result.task.settings.RestartCount == 5
|
||
|
- change_task_result.task.settings.RestartInterval == "PT1M"
|
||
|
|
||
|
- name: change task (idempotent)
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
state: present
|
||
|
author: Cow Inc.
|
||
|
description: Test for Ansible
|
||
|
allow_demand_start: no
|
||
|
restart_count: 5
|
||
|
restart_interval: PT1M
|
||
|
register: change_task_again
|
||
|
|
||
|
- name: assert results of change task (idempotent)
|
||
|
assert:
|
||
|
that:
|
||
|
- not change_task_again|changed
|
||
|
|
||
|
- name: add task action (check mode)
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
state: present
|
||
|
actions:
|
||
|
- path: cmd.exe
|
||
|
arguments: /c echo hi
|
||
|
- path: powershell.exe
|
||
|
arguments: -File C:\ansible\script.ps1
|
||
|
working_directory: C:\ansible
|
||
|
register: add_task_action_check
|
||
|
check_mode: yes
|
||
|
|
||
|
- name: get result of add task action (check mode)
|
||
|
test_task_stat:
|
||
|
path: \
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
register: add_task_action_result_check
|
||
|
|
||
|
- name: assert results of add task action (check mode)
|
||
|
assert:
|
||
|
that:
|
||
|
- add_task_action_check|changed
|
||
|
- add_task_action_result_check.task.actions|count == 1
|
||
|
- add_task_action_result_check.task.actions[0].Path == "cmd.exe"
|
||
|
- add_task_action_result_check.task.actions[0].Arguments == "/c echo hi"
|
||
|
- add_task_action_result_check.task.actions[0].WorkingDirectory == None
|
||
|
|
||
|
- name: add task action
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
state: present
|
||
|
actions:
|
||
|
- path: cmd.exe
|
||
|
arguments: /c echo hi
|
||
|
- path: powershell.exe
|
||
|
arguments: -File C:\ansible\script.ps1
|
||
|
working_directory: C:\ansible
|
||
|
register: add_task_action
|
||
|
|
||
|
- name: get result of add task action
|
||
|
test_task_stat:
|
||
|
path: \
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
register: add_task_action_result
|
||
|
|
||
|
- name: assert results of add task action
|
||
|
assert:
|
||
|
that:
|
||
|
- add_task_action|changed
|
||
|
- add_task_action_result.task.actions|count == 2
|
||
|
- add_task_action_result.task.actions[0].Path == "cmd.exe"
|
||
|
- add_task_action_result.task.actions[0].Arguments == "/c echo hi"
|
||
|
- add_task_action_result.task.actions[0].WorkingDirectory == None
|
||
|
- add_task_action_result.task.actions[1].Path == "powershell.exe"
|
||
|
- add_task_action_result.task.actions[1].Arguments == "-File C:\\ansible\\script.ps1"
|
||
|
- add_task_action_result.task.actions[1].WorkingDirectory == "C:\\ansible"
|
||
|
|
||
|
- name: add task action (idempotent)
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
state: present
|
||
|
actions:
|
||
|
- path: cmd.exe
|
||
|
arguments: /c echo hi
|
||
|
- path: powershell.exe
|
||
|
arguments: -File C:\ansible\script.ps1
|
||
|
working_directory: C:\ansible
|
||
|
register: add_task_action_again
|
||
|
|
||
|
- name: assert results of add task action (idempotent)
|
||
|
assert:
|
||
|
that:
|
||
|
- not add_task_action_again|changed
|
||
|
|
||
|
- name: remove task action (check mode)
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
state: present
|
||
|
actions:
|
||
|
- path: powershell.exe
|
||
|
arguments: -File C:\ansible\script.ps1
|
||
|
working_directory: C:\ansible
|
||
|
register: remove_task_action_check
|
||
|
check_mode: yes
|
||
|
|
||
|
- name: get result of remove task action (check mode)
|
||
|
test_task_stat:
|
||
|
path: \
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
register: remove_task_action_result_check
|
||
|
|
||
|
- name: assert results of remove task action (check mode)
|
||
|
assert:
|
||
|
that:
|
||
|
- remove_task_action_check|changed
|
||
|
- remove_task_action_result_check.task.actions|count == 2
|
||
|
- remove_task_action_result_check.task.actions[0].Path == "cmd.exe"
|
||
|
- remove_task_action_result_check.task.actions[0].Arguments == "/c echo hi"
|
||
|
- remove_task_action_result_check.task.actions[0].WorkingDirectory == None
|
||
|
- remove_task_action_result_check.task.actions[1].Path == "powershell.exe"
|
||
|
- remove_task_action_result_check.task.actions[1].Arguments == "-File C:\\ansible\\script.ps1"
|
||
|
- remove_task_action_result_check.task.actions[1].WorkingDirectory == "C:\\ansible"
|
||
|
|
||
|
- name: remove task action
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
state: present
|
||
|
actions:
|
||
|
- path: powershell.exe
|
||
|
arguments: -File C:\ansible\script.ps1
|
||
|
working_directory: C:\ansible
|
||
|
register: remove_task_action
|
||
|
|
||
|
- name: get result of remove task action
|
||
|
test_task_stat:
|
||
|
path: \
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
register: remove_task_action_result
|
||
|
|
||
|
- name: assert results of remove task action
|
||
|
assert:
|
||
|
that:
|
||
|
- remove_task_action|changed
|
||
|
- remove_task_action_result.task.actions|count == 1
|
||
|
- remove_task_action_result.task.actions[0].Path == "powershell.exe"
|
||
|
- remove_task_action_result.task.actions[0].Arguments == "-File C:\\ansible\\script.ps1"
|
||
|
- remove_task_action_result.task.actions[0].WorkingDirectory == "C:\\ansible"
|
||
|
|
||
|
- name: remove task action (idempontent)
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
state: present
|
||
|
actions:
|
||
|
- path: powershell.exe
|
||
|
arguments: -File C:\ansible\script.ps1
|
||
|
working_directory: C:\ansible
|
||
|
register: remove_task_action_again
|
||
|
|
||
|
- name: assert results of remove task action (idempotent)
|
||
|
assert:
|
||
|
that:
|
||
|
- not remove_task_action_again|changed
|
||
|
|
||
|
- name: remove task (check mode)
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
state: absent
|
||
|
register: remove_task_check
|
||
|
check_mode: yes
|
||
|
|
||
|
- name: get result of remove task (check mode)
|
||
|
test_task_stat:
|
||
|
path: \
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
register: remove_task_result_check
|
||
|
|
||
|
- name: assert results of remove task (check mode)
|
||
|
assert:
|
||
|
that:
|
||
|
- remove_task_check|changed
|
||
|
- remove_task_result_check.task_exists == True
|
||
|
|
||
|
- name: remove task
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
state: absent
|
||
|
register: remove_task
|
||
|
|
||
|
- name: get result of remove task
|
||
|
test_task_stat:
|
||
|
path: \
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
register: remove_task_result
|
||
|
|
||
|
- name: assert results of remove task
|
||
|
assert:
|
||
|
that:
|
||
|
- remove_task|changed
|
||
|
- remove_task_result.task_exists == False
|
||
|
|
||
|
- name: remove task (idempotent)
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
state: absent
|
||
|
register: remove_task_again
|
||
|
|
||
|
- name: assert results of remove task (idempotent)
|
||
|
assert:
|
||
|
that:
|
||
|
- not remove_task_again|changed
|
||
|
|
||
|
- name: create sole task in folder (check mode)
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
path: '{{test_scheduled_task_path}}'
|
||
|
actions:
|
||
|
- path: cmd.exe
|
||
|
register: create_sole_task_check
|
||
|
check_mode: yes
|
||
|
|
||
|
- name: get result of create sole task in folder (check mode)
|
||
|
test_task_stat:
|
||
|
path: '{{test_scheduled_task_path}}'
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
register: create_sole_task_result_check
|
||
|
|
||
|
- name: assert results of create sole task in folder (check mode)
|
||
|
assert:
|
||
|
that:
|
||
|
- create_sole_task_check|changed
|
||
|
- create_sole_task_result_check.folder_exists == False
|
||
|
- create_sole_task_result_check.task_exists == False
|
||
|
|
||
|
- name: create sole task in folder
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
path: '{{test_scheduled_task_path}}'
|
||
|
actions:
|
||
|
- path: cmd.exe
|
||
|
register: create_sole_task
|
||
|
|
||
|
- name: get result of create sole task in folder
|
||
|
test_task_stat:
|
||
|
path: '{{test_scheduled_task_path}}'
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
register: create_sole_task_result
|
||
|
|
||
|
- name: assert results of create sole task in folder
|
||
|
assert:
|
||
|
that:
|
||
|
- create_sole_task|changed
|
||
|
- create_sole_task_result.folder_exists == True
|
||
|
- create_sole_task_result.task_exists == True
|
||
|
|
||
|
- name: create sole task in folder (idempotent)
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
path: '{{test_scheduled_task_path}}'
|
||
|
actions:
|
||
|
- path: cmd.exe
|
||
|
register: create_sole_task_again
|
||
|
|
||
|
- name: assert results of create sole task in folder (idempotent)
|
||
|
assert:
|
||
|
that:
|
||
|
- not create_sole_task_again|changed
|
||
|
|
||
|
- name: remove sole task in folder (check mode)
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
path: '{{test_scheduled_task_path}}'
|
||
|
state: absent
|
||
|
register: remove_sole_task_check
|
||
|
check_mode: yes
|
||
|
|
||
|
- name: get result of remove sole task in folder (check mode)
|
||
|
test_task_stat:
|
||
|
path: '{{test_scheduled_task_path}}'
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
register: remove_sole_task_result_check
|
||
|
|
||
|
- name: assert results of remove sole task in folder (check mode)
|
||
|
assert:
|
||
|
that:
|
||
|
- remove_sole_task_check|changed
|
||
|
- remove_sole_task_result_check.folder_exists == True
|
||
|
- remove_sole_task_result_check.task_exists == True
|
||
|
|
||
|
- name: remove sole task in folder
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
path: '{{test_scheduled_task_path}}'
|
||
|
state: absent
|
||
|
register: remove_sole_task
|
||
|
|
||
|
- name: get result of remove sole task in folder
|
||
|
test_task_stat:
|
||
|
path: '{{test_scheduled_task_path}}'
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
register: remove_sole_task_result
|
||
|
|
||
|
- name: assert results of remove sole task in folder
|
||
|
assert:
|
||
|
that:
|
||
|
- remove_sole_task|changed
|
||
|
- remove_sole_task_result.folder_exists == False
|
||
|
- remove_sole_task_result.task_exists == False
|
||
|
|
||
|
- name: remove sole task in folder (idempotent)
|
||
|
win_scheduled_task:
|
||
|
name: '{{test_scheduled_task_name}}'
|
||
|
path: '{{test_scheduled_task_path}}'
|
||
|
state: absent
|
||
|
register: remove_sole_task_again
|
||
|
|
||
|
- name: assert results of remove sole task in folder (idempotent)
|
||
|
assert:
|
||
|
that:
|
||
|
- not remove_sole_task_again|changed
|