Don't make a complex installation, it does not work and is not clean
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>certbot_on_virtu
parent
c87c860ae5
commit
0fbafdf4cb
|
@ -31,18 +31,6 @@
|
||||||
retries: 3
|
retries: 3
|
||||||
until: apt_result is succeeded
|
until: apt_result is succeeded
|
||||||
|
|
||||||
- name: Set configuration directories in development mode
|
|
||||||
when: printer.version != "main"
|
|
||||||
set_fact:
|
|
||||||
module_path: "/var/local/django-printer/printer"
|
|
||||||
project_path: "/var/local/django-printer"
|
|
||||||
|
|
||||||
- name: Set configuration directories in production mode
|
|
||||||
when: printer.version == "main"
|
|
||||||
set_fact:
|
|
||||||
module_path: "/usr/local/lib/python3.9/dist-packages/printer"
|
|
||||||
project_path: "/usr/local/lib/python3.9/dist-packages/printer"
|
|
||||||
|
|
||||||
- name: Create django-printer configuration directory
|
- name: Create django-printer configuration directory
|
||||||
file:
|
file:
|
||||||
path: "/etc/django-printer"
|
path: "/etc/django-printer"
|
||||||
|
@ -61,41 +49,24 @@
|
||||||
state: query
|
state: query
|
||||||
ignore_errors: "{{ ansible_check_mode }}"
|
ignore_errors: "{{ ansible_check_mode }}"
|
||||||
|
|
||||||
- name: Clone printer repository (development)
|
- name: Clone printer repository
|
||||||
when: printer.version != "main"
|
|
||||||
git:
|
git:
|
||||||
repo: 'https://gitlab.adm.crans.org/nounous/django-printer.git'
|
repo: 'https://gitlab.adm.crans.org/nounous/django-printer.git'
|
||||||
dest: "{{ project_path }}"
|
dest: "/var/local/django-printer"
|
||||||
umask: '002'
|
umask: '002'
|
||||||
version: "{{ printer.version }}"
|
version: "{{ printer.version }}"
|
||||||
recursive: true
|
recursive: true
|
||||||
|
|
||||||
- name: Install pip module with editable flag (development)
|
|
||||||
when: printer.version != "main"
|
|
||||||
pip:
|
|
||||||
name:
|
|
||||||
- "{{ project_path }}"
|
|
||||||
editable: true
|
|
||||||
state: latest
|
|
||||||
|
|
||||||
- name: Install and upgrade django-printer (production)
|
|
||||||
when: printer.version == "main"
|
|
||||||
pip:
|
|
||||||
name:
|
|
||||||
- git+https://gitlab.adm.crans.org/nounous/django-printer.git
|
|
||||||
state: latest
|
|
||||||
|
|
||||||
- name: Set owner of cloned project
|
- name: Set owner of cloned project
|
||||||
when: printer.version != "main"
|
|
||||||
file:
|
file:
|
||||||
path: "{{ project_path }}"
|
path: "/var/local/django-printer"
|
||||||
owner: "{{ printer.owner }}"
|
owner: "{{ printer.owner }}"
|
||||||
group: "{{ printer.group }}"
|
group: "{{ printer.group }}"
|
||||||
recurse: true
|
recurse: true
|
||||||
|
|
||||||
- name: Set manage.py executable
|
- name: Set manage.py executable
|
||||||
file:
|
file:
|
||||||
path: "{{ module_path }}/manage.py"
|
path: "/var/local/django-printer/manage.py"
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: Deploy local settings
|
- name: Deploy local settings
|
||||||
|
@ -107,7 +78,7 @@
|
||||||
- name: Symlink configuration file
|
- name: Symlink configuration file
|
||||||
file:
|
file:
|
||||||
src: "/etc/django-printer/settings_local.py"
|
src: "/etc/django-printer/settings_local.py"
|
||||||
dest: "{{ module_path }}/settings_local.py"
|
dest: "/var/local/django-printer/printer/settings_local.py"
|
||||||
state: link
|
state: link
|
||||||
ignore_errors: "{{ ansible_check_mode }}"
|
ignore_errors: "{{ ansible_check_mode }}"
|
||||||
|
|
||||||
|
@ -115,13 +86,13 @@
|
||||||
- name: Make Django migrations
|
- name: Make Django migrations
|
||||||
django_manage:
|
django_manage:
|
||||||
command: makemigrations
|
command: makemigrations
|
||||||
project_path: "{{ project_path }}"
|
project_path: "/var/local/django-printer"
|
||||||
notify: Restart uWSGI
|
notify: Restart uWSGI
|
||||||
|
|
||||||
- name: Migrate database
|
- name: Migrate database
|
||||||
django_manage:
|
django_manage:
|
||||||
command: migrate
|
command: migrate
|
||||||
project_path: "{{ project_path }}"
|
project_path: "/var/local/django-printer"
|
||||||
notify: Restart uWSGI
|
notify: Restart uWSGI
|
||||||
|
|
||||||
- name: Create static files directory
|
- name: Create static files directory
|
||||||
|
@ -139,13 +110,13 @@
|
||||||
- name: Collect static files
|
- name: Collect static files
|
||||||
django_manage:
|
django_manage:
|
||||||
command: collectstatic
|
command: collectstatic
|
||||||
project_path: "{{ project_path }}"
|
project_path: "/var/local/django-printer"
|
||||||
notify: Restart uWSGI
|
notify: Restart uWSGI
|
||||||
|
|
||||||
- name: Compile messages
|
- name: Compile messages
|
||||||
django_manage:
|
django_manage:
|
||||||
command: compilemessages
|
command: compilemessages
|
||||||
project_path: "{{ project_path }}"
|
project_path: "/var/local/django-printer"
|
||||||
|
|
||||||
- name: Copy uWSGI app
|
- name: Copy uWSGI app
|
||||||
template:
|
template:
|
||||||
|
@ -175,15 +146,8 @@
|
||||||
group: www-data
|
group: www-data
|
||||||
mode: u=rwx,g=rwxs,o=rx
|
mode: u=rwx,g=rwxs,o=rx
|
||||||
|
|
||||||
- name: Clone projet to get documentation sources
|
|
||||||
git:
|
|
||||||
repo: 'https://gitlab.adm.crans.org/nounous/django-printer.git'
|
|
||||||
dest: '/tmp/django-printer'
|
|
||||||
umask: '002'
|
|
||||||
version: "{{ printer.version }}"
|
|
||||||
|
|
||||||
- name: Build HTML documentation
|
- name: Build HTML documentation
|
||||||
command: "sphinx-build -b dirhtml /tmp/django-printer/docs/ /var/www/django-printer-doc/"
|
command: "sphinx-build -b dirhtml /var/local/django-printer/docs/ /var/www/django-printer-doc/"
|
||||||
become_user: www-data
|
become_user: www-data
|
||||||
|
|
||||||
- name: Indicate module in motd
|
- name: Indicate module in motd
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/usr/bin/tail +14
|
#!/usr/bin/tail +14
|
||||||
{{ ansible_header | comment }}
|
{{ ansible_header | comment }}
|
||||||
[0m> [38;5;82mDjango-printer[0m a été déployé sur cette machine. Voir [38;5;6m{{ project_path }}/[0m.
|
[0m> [38;5;82mDjango-printer[0m a été déployé sur cette machine. Voir [38;5;6m/var/local/django-printer/[0m.
|
||||||
|
|
|
@ -5,6 +5,8 @@ uid = www-data
|
||||||
gid = www-data
|
gid = www-data
|
||||||
# Django-related settings
|
# Django-related settings
|
||||||
# the base directory (full path)
|
# the base directory (full path)
|
||||||
|
chdir = /var/local/django-printer
|
||||||
|
# Django's wsgi file
|
||||||
module = printer.wsgi:application
|
module = printer.wsgi:application
|
||||||
plugin = python3
|
plugin = python3
|
||||||
# process-related settings
|
# process-related settings
|
||||||
|
@ -15,4 +17,4 @@ processes = 10
|
||||||
# clear environment on exit
|
# clear environment on exit
|
||||||
vacuum = true
|
vacuum = true
|
||||||
# Touch reload
|
# Touch reload
|
||||||
touch-reload = {{ module_path }}/settings.py
|
touch-reload = /var/local/django-printer/printer/settings.py
|
||||||
|
|
Loading…
Reference in New Issue