有没有办法用ansbile
评论一个cron?我试图使用disable
但不工作。
剧本:cron: name="server_agent" disabled=yes
Error message:
You must specify 'job' to install a new cron job or variable
ansible version: ansible 2.3.1.0
使用ansible 2.6
,以下工作正常:
- name: "cron"
hosts: localhost
tasks:
- cron:
name: "test"
job: "/bin/true"
minute: "0"
hour: "9"
state: present
disabled: True
根据文档,这应该工作自ansible 2.0
。重要的是,disabled: True
只有在设置了state: present
时才有效。一个crontab -l
列表:
#Ansible: test
#0 9 * * * /bin/true