ansible-collections / community.windows

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

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

Closed pingtouskar closed 1 year ago

pingtouskar 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
pingtouskar commented 1 year ago

Closing this as I have opened from wrong account.