create_crontab_file.yml 354 B

1234567891011121314
  1. - name: recurring cron job
  2. hosts: webservers
  3. become: true
  4. tasks:
  5. - name: crontab file exists
  6. cron:
  7. name: Add date and time to a file
  8. minute: "*/2"
  9. hour: 9-16
  10. weekday: 1-5
  11. user: devops
  12. job: 'date >> /home/devops/my_date_time_cron_job'
  13. cron_file: add-date-time
  14. state: present