[constellation] More coherence between development and production

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
certbot_on_virtu
Yohann D'ANELLO 2021-04-02 09:33:28 +02:00
parent 372344fa10
commit de77238312
Signed by: _ynerant
GPG Key ID: 3A75C55819C8CF85
2 changed files with 22 additions and 18 deletions

View File

@ -23,16 +23,12 @@
set_fact: set_fact:
project_path: "/var/local/constellation" project_path: "/var/local/constellation"
module_path: "/var/local/constellation/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 - name: Set data directories in production mode
when: constellation.version == "master" when: constellation.version == "master"
set_fact: set_fact:
project_path: "/usr/local/lib/python3.9/dist-packages/constellation" project_path: "/usr/local/lib/python3.9/dist-packages/constellation"
module_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) - name: Check front dependencies (production)
when: constellation.version == "master" when: constellation.version == "master"
@ -92,15 +88,26 @@
- name: Create static files directory - name: Create static files directory
file: file:
path: "{{ item }}" path: "/var/lib/constellation/{{ item }}"
state: directory state: directory
mode: '2775' mode: '2775'
owner: "www-data" owner: "www-data"
group: "{{ constellation.group }}" group: "{{ constellation.group }}"
recurse: true recurse: true
loop: loop:
- "{{ static_dir }}" - static
- "{{ media_dir }}" - 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 - name: Collect static files
django_manage: django_manage:

View File

@ -31,20 +31,18 @@
- name: Set configuration directories in development mode - name: Set configuration directories in development mode
when: constellation.version != "master" when: constellation.version != "master"
set_fact: set_fact:
config_file: "/var/local/constellation/constellation/settings_local.py" module_path: "/var/local/constellation/constellation"
config_dir: "/var/local/constellation"
project_path: "/var/local/constellation" project_path: "/var/local/constellation"
- name: Set configuration directories in production mode - name: Set configuration directories in production mode
when: constellation.version == "master" when: constellation.version == "master"
set_fact: set_fact:
config_file: "/etc/constellation/settings_local.py" module_path: "/usr/local/lib/python3.9/dist-packages/constellation"
config_dir: "/etc/constellation"
project_path: "/usr/local/lib/python3.9/dist-packages/constellation" project_path: "/usr/local/lib/python3.9/dist-packages/constellation"
- name: Create constellation directory - name: Create constellation directory
file: file:
path: "{{ config_dir }}" path: "/etc/constellation"
state: directory state: directory
mode: '2775' mode: '2775'
owner: "{{ constellation.owner }}" owner: "{{ constellation.owner }}"
@ -52,7 +50,7 @@
- name: Set ACL for constellation directory - name: Set ACL for constellation directory
acl: acl:
path: "{{ config_dir }}" path: "/etc/constellation"
default: true default: true
entity: nounou entity: nounou
etype: group etype: group
@ -95,16 +93,15 @@
- name: Deploy Constellation settings_local.py - name: Deploy Constellation settings_local.py
template: template:
src: constellation/settings_local.py.j2 src: constellation/settings_local.py.j2
dest: "{{ config_file }}" dest: "/etc/constellation/settings_local.py"
mode: 0660 mode: 0660
owner: "{{ constellation.settings_local_owner }}" owner: "{{ constellation.settings_local_owner }}"
group: "{{ constellation.settings_local_group }}" group: "{{ constellation.settings_local_group }}"
- name: Symlink configuration file (production) - name: Symlink configuration file
when: constellation.version == "master"
file: file:
src: "{{ config_file }}" src: "/etc/constellation/settings_local.py"
dest: "{{ project_path }}/settings_local.py" dest: "{{ module_path }}/settings_local.py"
state: link state: link
- name: Deploy crontab - name: Deploy crontab