From de77238312adced92831579fcd62ae5c275d575c Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Fri, 2 Apr 2021 09:33:28 +0200 Subject: [PATCH] [constellation] More coherence between development and production Signed-off-by: Yohann D'ANELLO --- roles/constellation-front/tasks/main.yml | 21 ++++++++++++++------- roles/constellation/tasks/main.yml | 19 ++++++++----------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/roles/constellation-front/tasks/main.yml b/roles/constellation-front/tasks/main.yml index 9880fd11..1943e209 100644 --- a/roles/constellation-front/tasks/main.yml +++ b/roles/constellation-front/tasks/main.yml @@ -23,16 +23,12 @@ set_fact: project_path: "/var/local/constellation" module_path: "/var/local/constellation/constellation" - static_dir: "/var/local/constellation/static" - media_dir: "/var/local/constellation/media" - name: Set data directories in production mode when: constellation.version == "master" set_fact: project_path: "/usr/local/lib/python3.9/dist-packages/constellation" module_path: "/usr/local/lib/python3.9/dist-packages/constellation" - static_dir: "/var/lib/constellation/static" - media_dir: "/var/lib/constellation/media" - name: Check front dependencies (production) when: constellation.version == "master" @@ -92,15 +88,26 @@ - name: Create static files directory file: - path: "{{ item }}" + path: "/var/lib/constellation/{{ item }}" state: directory mode: '2775' owner: "www-data" group: "{{ constellation.group }}" recurse: true loop: - - "{{ static_dir }}" - - "{{ media_dir }}" + - static + - media + +- name: Symlink static and media directories (dev) + file: + src: "/var/lib/constellation/{{ item }}" + dest: "/var/local/constellation/{{ item }}" + state: link + owner: 'www-data' + group: '{{ constellation.group }}' + loop: + - static + - media - name: Collect static files django_manage: diff --git a/roles/constellation/tasks/main.yml b/roles/constellation/tasks/main.yml index 8da6d591..0f289313 100644 --- a/roles/constellation/tasks/main.yml +++ b/roles/constellation/tasks/main.yml @@ -31,20 +31,18 @@ - name: Set configuration directories in development mode when: constellation.version != "master" set_fact: - config_file: "/var/local/constellation/constellation/settings_local.py" - config_dir: "/var/local/constellation" + module_path: "/var/local/constellation/constellation" project_path: "/var/local/constellation" - name: Set configuration directories in production mode when: constellation.version == "master" set_fact: - config_file: "/etc/constellation/settings_local.py" - config_dir: "/etc/constellation" + module_path: "/usr/local/lib/python3.9/dist-packages/constellation" project_path: "/usr/local/lib/python3.9/dist-packages/constellation" - name: Create constellation directory file: - path: "{{ config_dir }}" + path: "/etc/constellation" state: directory mode: '2775' owner: "{{ constellation.owner }}" @@ -52,7 +50,7 @@ - name: Set ACL for constellation directory acl: - path: "{{ config_dir }}" + path: "/etc/constellation" default: true entity: nounou etype: group @@ -95,16 +93,15 @@ - name: Deploy Constellation settings_local.py template: src: constellation/settings_local.py.j2 - dest: "{{ config_file }}" + dest: "/etc/constellation/settings_local.py" mode: 0660 owner: "{{ constellation.settings_local_owner }}" group: "{{ constellation.settings_local_group }}" -- name: Symlink configuration file (production) - when: constellation.version == "master" +- name: Symlink configuration file file: - src: "{{ config_file }}" - dest: "{{ project_path }}/settings_local.py" + src: "/etc/constellation/settings_local.py" + dest: "{{ module_path }}/settings_local.py" state: link - name: Deploy crontab