blender-open-data/playbooks/configure_crontab.yaml

43 lines
1.1 KiB
YAML

---
- hosts: application
gather_facts: false
become: true
tags:
- crontab
tasks:
- name: Copying snapshot script
ansible.builtin.template:
src: make_snapshot.sh
dest: /usr/local/bin/make_opendata_snapshot.sh
owner: "{{ user }}"
group: "{{ group }}"
mode: 0750
- name: Setting up snapshot cron job
ansible.builtin.cron:
name: Generate a daily snapshot of Open Data
user: "{{ user }}"
special_time: daily
job: /bin/bash /usr/local/bin/make_opendata_snapshot.sh
- name: Setting up cron jobs
ansible.builtin.cron:
name: "{{ item.name }}"
minute: "{{ item.minute }}"
hour: "{{ item.hour }}"
user: "{{ user }}"
job: "{{ item.job }}"
loop:
- name: Clear old sessions
job: "{{ dir.source }}/website/.venv/bin/python {{ dir.source }}/website/manage.py clearsessions"
minute: 9
hour: "*"
- import_tasks: common/tasks/configure_dir_backup.yaml
vars:
hour: 0
minute: 12
weekday: 6
directories:
- "{{ dir.source }}"