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
 | 
			
		||||
  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
 | 
			
		||||
  file:
 | 
			
		||||
    path: "/etc/django-printer"
 | 
			
		||||
| 
						 | 
				
			
			@ -61,41 +49,24 @@
 | 
			
		|||
    state: query
 | 
			
		||||
  ignore_errors: "{{ ansible_check_mode }}"
 | 
			
		||||
 | 
			
		||||
- name: Clone printer repository (development)
 | 
			
		||||
  when: printer.version != "main"
 | 
			
		||||
- name: Clone printer repository
 | 
			
		||||
  git:
 | 
			
		||||
    repo: 'https://gitlab.adm.crans.org/nounous/django-printer.git'
 | 
			
		||||
    dest: "{{ project_path }}"
 | 
			
		||||
    dest: "/var/local/django-printer"
 | 
			
		||||
    umask: '002'
 | 
			
		||||
    version: "{{ printer.version }}"
 | 
			
		||||
    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
 | 
			
		||||
  when: printer.version != "main"
 | 
			
		||||
  file:
 | 
			
		||||
    path: "{{ project_path }}"
 | 
			
		||||
    path: "/var/local/django-printer"
 | 
			
		||||
    owner: "{{ printer.owner }}"
 | 
			
		||||
    group: "{{ printer.group }}"
 | 
			
		||||
    recurse: true
 | 
			
		||||
 | 
			
		||||
- name: Set manage.py executable
 | 
			
		||||
  file:
 | 
			
		||||
    path: "{{ module_path }}/manage.py"
 | 
			
		||||
    path: "/var/local/django-printer/manage.py"
 | 
			
		||||
    mode: 0755
 | 
			
		||||
 | 
			
		||||
- name: Deploy local settings
 | 
			
		||||
| 
						 | 
				
			
			@ -107,7 +78,7 @@
 | 
			
		|||
- name: Symlink configuration file
 | 
			
		||||
  file:
 | 
			
		||||
    src: "/etc/django-printer/settings_local.py"
 | 
			
		||||
    dest: "{{ module_path }}/settings_local.py"
 | 
			
		||||
    dest: "/var/local/django-printer/printer/settings_local.py"
 | 
			
		||||
    state: link
 | 
			
		||||
  ignore_errors: "{{ ansible_check_mode }}"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -115,13 +86,13 @@
 | 
			
		|||
- name: Make Django migrations
 | 
			
		||||
  django_manage:
 | 
			
		||||
    command: makemigrations
 | 
			
		||||
    project_path: "{{ project_path }}"
 | 
			
		||||
    project_path: "/var/local/django-printer"
 | 
			
		||||
  notify: Restart uWSGI
 | 
			
		||||
 | 
			
		||||
- name: Migrate database
 | 
			
		||||
  django_manage:
 | 
			
		||||
    command: migrate
 | 
			
		||||
    project_path: "{{ project_path }}"
 | 
			
		||||
    project_path: "/var/local/django-printer"
 | 
			
		||||
  notify: Restart uWSGI
 | 
			
		||||
 | 
			
		||||
- name: Create static files directory
 | 
			
		||||
| 
						 | 
				
			
			@ -139,13 +110,13 @@
 | 
			
		|||
- name: Collect static files
 | 
			
		||||
  django_manage:
 | 
			
		||||
    command: collectstatic
 | 
			
		||||
    project_path: "{{ project_path }}"
 | 
			
		||||
    project_path: "/var/local/django-printer"
 | 
			
		||||
  notify: Restart uWSGI
 | 
			
		||||
 | 
			
		||||
- name: Compile messages
 | 
			
		||||
  django_manage:
 | 
			
		||||
    command: compilemessages
 | 
			
		||||
    project_path: "{{ project_path }}"
 | 
			
		||||
    project_path: "/var/local/django-printer"
 | 
			
		||||
 | 
			
		||||
- name: Copy uWSGI app
 | 
			
		||||
  template:
 | 
			
		||||
| 
						 | 
				
			
			@ -175,15 +146,8 @@
 | 
			
		|||
    group: www-data
 | 
			
		||||
    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
 | 
			
		||||
  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
 | 
			
		||||
 | 
			
		||||
- name: Indicate module in motd
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,3 @@
 | 
			
		|||
#!/usr/bin/tail +14
 | 
			
		||||
{{ 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
 | 
			
		||||
# Django-related settings
 | 
			
		||||
# the base directory (full path)
 | 
			
		||||
chdir           = /var/local/django-printer
 | 
			
		||||
# Django's wsgi file
 | 
			
		||||
module          = printer.wsgi:application
 | 
			
		||||
plugin          = python3
 | 
			
		||||
# process-related settings
 | 
			
		||||
| 
						 | 
				
			
			@ -15,4 +17,4 @@ processes       = 10
 | 
			
		|||
# clear environment on exit
 | 
			
		||||
vacuum          = true
 | 
			
		||||
# Touch reload
 | 
			
		||||
touch-reload = {{ module_path }}/settings.py
 | 
			
		||||
touch-reload = /var/local/django-printer/printer/settings.py
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue