From 9f165ad9be0047530c874606fdeac80e289f880c Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO <ynerant@crans.org> Date: Fri, 26 Mar 2021 08:57:22 +0100 Subject: [PATCH] [constellation] Deploy crontab Signed-off-by: Yohann D'ANELLO <ynerant@crans.org> --- group_vars/constellation.yml | 3 ++- roles/constellation/tasks/main.yml | 17 +++++++++++++++++ .../templates/cron.d/constellation.j2 | 4 ++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 roles/constellation/templates/cron.d/constellation.j2 diff --git a/group_vars/constellation.yml b/group_vars/constellation.yml index e3ace5a7..728aeb3c 100644 --- a/group_vars/constellation.yml +++ b/group_vars/constellation.yml @@ -20,7 +20,8 @@ glob_constellation: user: 'constellation' password: "{{ vault.constellation_django_db_password }}" name: 'constellation' - front: True + front: true + crontab: true applications: - 'access' - 'billing' diff --git a/roles/constellation/tasks/main.yml b/roles/constellation/tasks/main.yml index 2e2a4154..8da6d591 100644 --- a/roles/constellation/tasks/main.yml +++ b/roles/constellation/tasks/main.yml @@ -69,6 +69,14 @@ version: "{{ constellation.version }}" recursive: true +- name: Install pip module with editable flag (development) + when: constellation.version != "master" + pip: + name: + - "{{ project_path }}" + editable: true + state: latest + - name: Install and upgrade constellation (production) when: constellation.version == "master" pip: @@ -99,6 +107,15 @@ dest: "{{ project_path }}/settings_local.py" state: link +- name: Deploy crontab + when: constellation.crontab + template: + src: "cron.d/constellation.j2" + dest: "/etc/cron.d/constellation" + owner: root + group: root + mode: 0644 + - name: Compile messages when: not constellation.front django_manage: diff --git a/roles/constellation/templates/cron.d/constellation.j2 b/roles/constellation/templates/cron.d/constellation.j2 new file mode 100644 index 00000000..c87dbea9 --- /dev/null +++ b/roles/constellation/templates/cron.d/constellation.j2 @@ -0,0 +1,4 @@ +{{ ansible_header }} + +# m h dom mon dow user command +24 4 * * * root constellation check_consistency