首页 > 解决方案 > Scheduled task creation in Ansible with option to keep it running forever

问题描述

I have created a playbook to create a scheduled task in windows. See below:

- 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"

However, the task that gets created has the option "Stop the task if it runs longer than: 3 days" selected.

I don't want this task to stop. How can I achieve this?

标签: windowsansibleansible-2.x

解决方案


感谢@Welsh 的评论,找到了解决方案

只需要添加

execution_time_limit: PT0S


推荐阅读