blender-open-data/playbooks/configure_crontab.yaml

41 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 MAILTO to {{ mailto }}
ansible.builtin.cronvar:
name: MAILTO
value: "{{ mailto }}"
user: "{{ user }}"
- 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: "*"