在 Ansible 中创建计划任务,并可选择永久保留 运行
Scheduled task creation in Ansible with option to keep it running forever
我已经创建了一个 playbook 来在 windows 中创建计划任务。见下文:
- name: Create Task
win_scheduled_task:
name: "{{ memcache_task_name }}"
description: Startup for Memcache service
state: present
triggers:
- type: boot
enabled: yes
logon_type: password
run_level: highest
actions:
- path: "{{ memcache_dir }}"
author: "author"
username: "user"
password: "password"
restart_count: 3
restart_interval: "PT5M"
但是,创建的任务选择了 "Stop the task if it runs longer than: 3 days" 选项。
我不想让这个任务停止。我怎样才能做到这一点?
感谢 @Welsh
的评论找到了解决方案
只需添加
execution_time_limit: PT0S
我已经创建了一个 playbook 来在 windows 中创建计划任务。见下文:
- name: Create Task
win_scheduled_task:
name: "{{ memcache_task_name }}"
description: Startup for Memcache service
state: present
triggers:
- type: boot
enabled: yes
logon_type: password
run_level: highest
actions:
- path: "{{ memcache_dir }}"
author: "author"
username: "user"
password: "password"
restart_count: 3
restart_interval: "PT5M"
但是,创建的任务选择了 "Stop the task if it runs longer than: 3 days" 选项。
我不想让这个任务停止。我怎样才能做到这一点?
感谢 @Welsh
的评论找到了解决方案只需添加
execution_time_limit: PT0S