'Possible way to add multiple start_boundary for community.windows.win_scheduled_task
Been trying to find ways to make a trigger to work by setting a schedule task to run at 3 specific times but have not had any luck.
Current code fails as seen below.
community.windows.win_scheduled_task:
Code:
- name: Create task with multiple triggers
community.windows.win_scheduled_task:
name: TriggerTask
path: \Custom
actions:
- path: cmd.exe
triggers:
- type: daily
- start_boundary: '2022-01-01T05:00:00','2022-01-01T11:00:00','2022-01-01T17:00:00'
username: SYSTEM
state: present
enabled: yes
Solution 1:[1]
The documentation seems to point to the fact that triggers is a list that can accept multiple value.
I don't have a Windows host to test it, but, a possible way to achieve it that kind of match what the documentation is indicating would be to have a list under the trigger parameters, like this:
triggers:
- type: daily
start_boundary: '2022-01-01T05:00:00'
- type: daily
start_boundary: '2022-01-01T11:00:00'
- type: daily
start_boundary: '2022-01-01T17:00:00'
Ending up with this task:
- name: Create task with multiple triggers
community.windows.win_scheduled_task:
name: TriggerTask
path: \Custom
actions:
- path: cmd.exe
triggers:
- type: daily
start_boundary: '2022-01-01T05:00:00'
- type: daily
start_boundary: '2022-01-01T11:00:00'
- type: daily
start_boundary: '2022-01-01T17:00:00'
username: SYSTEM
state: present
enabled: yes
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | β.εηοιτ.βε |
