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.
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'.
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: user@domain.com on PORT 5985 TO host.domain.com
calling kinit with subprocess for principal user@domain.com
EXEC (via pipeline wrapper)
fatal: [host.domain.com]: FAILED! => {
"changed": false,
"msg": "invalid day of month '0', please specify numbers from 1-31"
}
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
COMPONENT NAME
win_scheduled_task
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
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'.
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"