"<p><strong>Ansible Crons :</strong></p> <p>In this Snippet, we are scheduling a database backup every day at 5:00 AM.</p> <pre class="language-markup"><code>- name: "Daily Database backup CRON" cron: name: "daily-database-backup" state: present minute: "0" hour: "5" day: "*" month: "*" weekday: "*" job: "{{ scripts_path }}/db-backup.sh 2>> /var/log/cron.log" user: "{{ user }}" become: true</code></pre> <p><strong>Clean Backup Cron  :</strong></p> <p>This Ansible task sets up a cron job named "clean-db-backup-folder" that runs at 6:00 AM every Saturday. It removes older backup files (keeping the latest 60) from the specified backup path and logs the action to "/var/log/cron.log."</p> <pre class="language-markup"><code>- name: "CRON | Clean DB Backup Folder" cron: name: "clean-db-backup-folder" state: present minute: "0" hour: "6" day: "*" month: "*" weekday: "6" job: "cd {{ backup_path }} && ls -tr | head -n -60 | xargs --no-run-if-empty rm >> /var/log/cron.log 2>&1" user: "{{ user }}" become: true</code></pre> <p>Regularly cleaning old backups is crucial because they help prevent the accumulation of unnecessary data that can occupy valuable storage space. As backups are created over time, they can pile up and consume substantial storage resources, which can become costly and in[efficient.</p>"