This article was originally published on bmf-tech.com.
Overview
This task involves setting up cron with Ansible.
Playbook
Below is an example configuration to execute a task every minute.
---
- hosts: vps
become: yes
user: root
tasks:
- name: Output recently logined users
cron:
name: last.sh
job: last.sh
minute: "*/1"
A point to note is that if you want to write */1, you need to enclose it in double quotes. If not enclosed, a syntax error will occur. (Need to study YAML more... lol)
Thoughts
The cron setup went smoothly without any issues.
Top comments (0)