From 98263de23f4667942327aecddd9c67786a60cebb Mon Sep 17 00:00:00 2001
From: Yohann D'ANELLO <ynerant@crans.org>
Date: Wed, 24 Mar 2021 14:23:22 +0100
Subject: [PATCH] [constellation] Properly separe constellation and
 constellation-front

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
---
 group_vars/constellation-front.yml          | 30 +++++++++++++++++++++
 group_vars/constellation.yml                | 30 ---------------------
 hosts                                       |  7 +++--
 plays/constellation.yml                     |  7 ++++-
 roles/constellation-front/handlers/main.yml |  5 ----
 5 files changed, 41 insertions(+), 38 deletions(-)
 create mode 100644 group_vars/constellation-front.yml

diff --git a/group_vars/constellation-front.yml b/group_vars/constellation-front.yml
new file mode 100644
index 00000000..e621e946
--- /dev/null
+++ b/group_vars/constellation-front.yml
@@ -0,0 +1,30 @@
+---
+loc_nginx:
+  service_name: constellation
+  ssl: []
+  servers:
+    - ssl: false
+      default: true
+      server_name:
+        - "constellation.crans.org"
+        - "intranet.crans.org"
+      locations:
+        - filter: "/static"
+          params:
+            - "alias /var/local/constellation/static/"
+
+        - filter: "/javascript"
+          params:
+            - "alias /usr/share/javascript/"
+
+        - filter: "/media"
+          params:
+            - "alias /var/local/constellation/media/"
+
+        - filter: "/"
+          params:
+            - "uwsgi_pass constellation"
+            - "include /etc/nginx/uwsgi_params"
+  upstreams:
+    - name: 'constellation'
+      server: 'unix:///var/run/uwsgi/app/constellation/constellation.sock'
diff --git a/group_vars/constellation.yml b/group_vars/constellation.yml
index 76cd299a..e3ace5a7 100644
--- a/group_vars/constellation.yml
+++ b/group_vars/constellation.yml
@@ -40,33 +40,3 @@ glob_constellation:
   version: master
   settings_local_owner: www-data
   settings_local_group: nounou
-
-loc_nginx:
-  service_name: constellation
-  ssl: []
-  servers:
-    - ssl: false
-      default: true
-      server_name:
-        - "constellation.crans.org"
-        - "intranet.crans.org"
-      locations:
-        - filter: "/static"
-          params:
-            - "alias /var/local/constellation/static/"
-
-        - filter: "/javascript"
-          params:
-            - "alias /usr/share/javascript/"
-
-        - filter: "/media"
-          params:
-            - "alias /var/local/constellation/media/"
-
-        - filter: "/"
-          params:
-            - "uwsgi_pass constellation"
-            - "include /etc/nginx/uwsgi_params"
-  upstreams:
-    - name: 'constellation'
-      server: 'unix:///var/run/uwsgi/app/constellation/constellation.sock'
diff --git a/hosts b/hosts
index c628b91e..89a58973 100644
--- a/hosts
+++ b/hosts
@@ -45,7 +45,10 @@ reverseproxy
 thelounge
 vsftpd
 
-[constellation]
+[constellation:children]
+constellation-front
+
+[constellation-front]
 constellation-dev.adm.crans.org
 
 [dhcp:children]
@@ -139,7 +142,7 @@ eclat.adm.crans.org
 ptf.adm.crans.org
 
 [nginx:children]
-constellation
+constellation-front
 django_cas
 galene
 jitsi
diff --git a/plays/constellation.yml b/plays/constellation.yml
index 64f7c64d..3a1d5fed 100755
--- a/plays/constellation.yml
+++ b/plays/constellation.yml
@@ -3,8 +3,13 @@
 - hosts: constellation
   vars:
     constellation: "{{ glob_constellation | combine(loc_constellation | default({}), recursive=True) }}"
-    nginx: "{{ glob_nginx | combine(loc_nginx | default({})) }}"
   roles:
     - constellation
+
+- hosts: constellation-front
+  vars:
+    constellation: "{{ glob_constellation | combine(loc_constellation | default({}), recursive=True) }}"
+    nginx: "{{ glob_nginx | combine(loc_nginx | default({})) }}"
+  roles:
     - nginx
     - constellation-front
diff --git a/roles/constellation-front/handlers/main.yml b/roles/constellation-front/handlers/main.yml
index bc651bf9..2b15eaea 100644
--- a/roles/constellation-front/handlers/main.yml
+++ b/roles/constellation-front/handlers/main.yml
@@ -1,9 +1,4 @@
 ---
-- name: Reload NGINX
-  systemd:
-    name: nginx
-    state: reloaded
-
 - name: Reload uWSGI
   systemd:
     name: uwsgi
-- 
GitLab