ansible-collections / community.windows

Windows community collection for Ansible
https://galaxy.ansible.com/community/windows
GNU General Public License v3.0
203 stars 155 forks source link

win_scheduled_task: Unable to disable the task just with the job name #446

Open Udayendu opened 2 years ago

Udayendu commented 2 years ago

win_scheduled_task is unable to disable the task just with the task name.

SUMMARY

win_scheduled_task is unable to disable the task just with the task name. It required the folder details as well. Hence either code fix required to check it by the task name or documentation required some explanation. Documentation

- name: Disable a task that already exists
  community.windows.win_scheduled_task:
    name: TaskToDisable
    enabled: no
ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
Name: ansible
Version: 5.8.0
Summary: Radically simple IT automation
Home-page: https://ansible.com/
Author: Ansible, Inc.
Author-email: info@ansible.com
License: GPLv3+
Location: /usr/local/lib/python3.8/dist-packages
Requires: ansible-core
Required-by:
COLLECTION VERSION
# /usr/local/lib/python3.8/dist-packages/ansible_collections
Collection        Version
----------------- -------
community.windows 1.10.0
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS

It should stop the task as it is.

ACTUAL RESULTS

It failed to stop the scheduled task and giving the following error message:

failed: [x.x.x.x] (item=TaskToDisable) => {
    "changed": false,
    "item": "TaskToDisable",
    "msg": "cannot create a task with no actions, set at least one action with a path to an executable"
}

The task is under TaskChecker folder. So after including the path, its working well. But without path, its not able to search the job.

- name: Disable a task that already exists
  win_scheduled_task:
    path: \TaskChecker
    name: TaskToDisable
    enabled: no
Udayendu commented 2 years ago

Raised a doc bug fix via PR https://github.com/ansible-collections/community.windows/pull/447

klangborste commented 1 year ago

@Udayendu For me with path defined it leads to the next problem: #22