Merge branch 're2o' into 'newinfra'

Fix re2o role and add re2o-front role

See merge request nounous/ansible!185
certbot_on_virtu
_benjamin 2021-01-10 14:03:33 +01:00
commit 188611c3a9
6 changed files with 124 additions and 2 deletions

View File

@ -5,3 +5,6 @@
re2o: "{{ glob_re2o | combine(loc_re2o) }}" re2o: "{{ glob_re2o | combine(loc_re2o) }}"
roles: roles:
- re2o - re2o
- hosts: re2o.adm.crans.org
roles: ["re2o-front"]

View File

@ -0,0 +1,10 @@
---
- name: Reload NGINX
systemd:
name: nginx
state: reloaded
- name: Reload uWSGI
systemd:
name: uwsgi
state: reloaded

View File

@ -0,0 +1,47 @@
---
- name: Install re2o dependancies
apt:
update_cache: true
name:
- gettext
- graphviz
- texlive-fonts-recommended
- texlive-latex-base
register: apt_result
retries: 3
until: apt_result is succeeded
- name: Install NGINX and uWSGI
apt:
update_cache: true
name:
- nginx
- uwsgi
- uwsgi-plugin-python3
register: apt_result
retries: 3
until: apt_result is succeeded
- name: Copy re2o NGINX site
template:
src: "nginx/sites-available/re2o.j2"
dest: "/etc/nginx/sites-available/re2o"
- name: Copy re2o uWSGI app
template:
src: "uwsgi/apps-available/re2o.ini.j2"
dest: "/etc/uwsgi/apps-available/re2o.ini"
- name: Activate re2o NGINX site
file:
src: "../sites-available/re2o"
dest: "/etc/nginx/sites-enabled/re2o"
state: link
notify: Reload NGINX
- name: Activate re2o uWSGI app
file:
src: "../apps-available/re2o.ini"
dest: "/etc/uwsgi/apps-enabled/re2o.ini"
state: link
notify: Reload uWSGI

View File

@ -0,0 +1,35 @@
upstream re2o {
# Path of the unix socket. For example :
server unix:///var/run/uwsgi/app/re2o/re2o.sock;
}
server {
listen 80;
listen [::]:80;
server_name {{ (query('ldap', 'ip', 're2o', 'adm') | ipv4)[0] }} re2o.adm.crans.org intranet.crans.org intranet.infra.crans.org; # Modify this value according to your infrastructure.
charset utf-8;
server_tokens off;
location /static {
# Alias the path to the static files. For instance,
alias /var/www/re2o/static_files/;
}
location /javascript {
# Alias the path to the static files. For instance,
alias /usr/share/javascript/;
}
location /media {
alias /var/www/re2o/media/;
}
location / {
uwsgi_pass re2o;
# Include the uwsgi_params file. For instance :
include /etc/nginx/uwsgi_params;
}
}

View File

@ -0,0 +1,27 @@
{{ ansible_header | comment }}
[uwsgi]
uid = www-data
gid = www-data
# Django-related settings
# the base directory (full path)
chdir = /var/www/re2o
# Django's wsgi file
#module = winaps.wsgi:application
# the virtualenv (full path)
# home = /var/www/re2o/venv
wsgi-file = /var/www/re2o/re2o/wsgi.py
plugin = python3
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 10
# the socket (use the full path to be safe
socket = /var/run/uwsgi/app/re2o/re2o.sock
# ... with appropriate permissions - may be needed
chmod-socket = 664
# clear environment on exit
vacuum = true
#Touch reload
touch-reload = /var/www/re2o/re2o/settings.py

View File

@ -1,5 +1,5 @@
--- ---
- name: Install re2o dependencies - name: Install re2o dependancies
apt: apt:
update_cache: true update_cache: true
name: name:
@ -27,7 +27,7 @@
executable: pip3 executable: pip3
name: name:
- django-bootstrap3 - django-bootstrap3
- django-macaddress - django-macaddress==1.6.0
- name: Create re2o directory - name: Create re2o directory
file: file: