Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not create scheduled task that runs only on last day of month #569

Open
Craneson opened this issue Jun 14, 2024 · 0 comments
Open

Can not create scheduled task that runs only on last day of month #569

Craneson opened this issue Jun 14, 2024 · 0 comments

Comments

@Craneson
Copy link

SUMMARY

A task trigger can run on the days 1-31 and also on "last day of month", but it's not possible to only run on last day without any of the days 1-31.
Parameter 'days_of_month' for trigger type 'monthly' needs to allow 0 as a valid value, if 'run_on_last_day_of_month' is set to true.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_scheduled_task

ANSIBLE VERSION
ansible [core 2.15.3]
  config file = /home/in-kon.ch/pam_ecj/ta-playbooks/ansible.cfg
  configured module search path = ['/home/in-kon.ch/pam_ecj/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = /usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.5 (main, Sep 22 2023, 15:34:29) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20)] (/usr/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
# /usr/share/ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.windows 1.12.0
CONFIGURATION
COLLECTIONS_PATHS(/home/in-kon.ch/pam_ecj/ta-playbooks/ansible.cfg) = ['/usr/share/ansible/collections']
CONFIG_FILE() = /home/in-kon.ch/pam_ecj/ta-playbooks/ansible.cfg
DEFAULT_ROLES_PATH(/home/in-kon.ch/pam_ecj/ta-playbooks/ansible.cfg) = ['/home/in-kon.ch/pam_ecj/roles', '/usr/share/ansible/roles']
DEFAULT_VAULT_PASSWORD_FILE(/home/in-kon.ch/pam_ecj/ta-playbooks/ansible.cfg) = /home/in-kon.ch/pam_ecj/.ansible_vault
GALAXY_SERVER_LIST(/home/in-kon.ch/pam_ecj/ta-playbooks/ansible.cfg) = ['rh-certified_repo', 'community_repo', 'published_repo']
OS / ENVIRONMENT

Ansible: Red Hat Enterprise Linux release 8.9 (Ootpa)
Target: Windows Server 2016, Version 1607

STEPS TO REPRODUCE

Try to create a scheduled task with a trigger of type 'monthly'.
The trigger shall only run on last day of month, so set 'run_on_last_day_of_month: true' and 'days_of_month: 0'.

- name: Create a task
  community.windows.win_scheduled_task:
    name: TaskName
    actions:
    - path: cmd.exe
    triggers:
    - type: monthly
      days_of_month: 0
      run_on_last_day_of_month: true
      start_boundary: '2017-10-09T09:00:00'
EXPECTED RESULTS

A scheduled task will be created that has a monthly trigger that runs on last day of every month

ACTUAL RESULTS

The task fails with a message "invalid day of month '0', please specify numbers from 1-31"

TASK [Create a task] *******************************************************************************************************************************************
task path: /home/in-kon.ch/pam_ecj/ta-playbooks/ta_test_scheduldedtask.yml:17
Trying secret FileVaultSecret(filename='/home/in-kon.ch/pam_ecj/.ansible_vault') for vault_id=default
Trying secret FileVaultSecret(filename='/home/in-kon.ch/pam_ecj/.ansible_vault') for vault_id=default
Trying secret FileVaultSecret(filename='/home/in-kon.ch/pam_ecj/.ansible_vault') for vault_id=default
Using module file /usr/share/ansible/collections/ansible_collections/community/windows/plugins/modules/win_scheduled_task.ps1
Pipelining is enabled.
<host.domain.com> ESTABLISH WINRM CONNECTION FOR USER: [email protected] on PORT 5985 TO host.domain.com
calling kinit with subprocess for principal [email protected]
EXEC (via pipeline wrapper)
fatal: [host.domain.com]: FAILED! => {
    "changed": false,
    "msg": "invalid day of month '0', please specify numbers from 1-31"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant