[constellation] More coherence between development and production
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>certbot_on_virtu
							parent
							
								
									372344fa10
								
							
						
					
					
						commit
						de77238312
					
				| 
						 | 
				
			
			@ -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:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue