DEV Community

Cover image for Setting Up Cron with Ansible
Kenta Takeuchi
Kenta Takeuchi

Posted on • Originally published at bmf-tech.com

Setting Up Cron with Ansible

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"
Enter fullscreen mode Exit fullscreen mode

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.

Reference

Top comments (0)