From 5efb150583cb6fcc394f5a3208bb12a77e187896 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Tue, 1 Sep 2020 16:32:13 +0200 Subject: [PATCH] Update Ansible packages --- README.md | 2 +- ansible/roles/1-apt-basic/tasks/main.yml | 48 ++++++++++++++++++------ ansible/roles/2-nk20/tasks/main.yml | 14 +------ ansible/roles/3-pip/tasks/main.yml | 10 +---- ansible/roles/4-nginx/tasks/main.yml | 7 ++++ 5 files changed, 47 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 76cc69a3..5a0caa0f 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Sinon vous pouvez suivre les étapes ici. 3. **Création d'un environment de travail Python décorrélé du système.** ```bash - $ python3 -m venv env + $ python3 -m venv env --system-site-packages $ source env/bin/activate (env)$ pip3 install -r requirements.txt (env)$ deactivate # sortir de l'environnement diff --git a/ansible/roles/1-apt-basic/tasks/main.yml b/ansible/roles/1-apt-basic/tasks/main.yml index 105fbf36..f0ac56b2 100644 --- a/ansible/roles/1-apt-basic/tasks/main.yml +++ b/ansible/roles/1-apt-basic/tasks/main.yml @@ -1,23 +1,47 @@ --- -- name: Install basic APT packages +- name: Add buster-backports to apt sources + apt_repository: + repo: deb http://{{ mirror }}/debian buster-backports main + state: present + +- name: Install note_kfet APT dependencies apt: update_cache: true + default_release: buster-backports name: - - nginx - - python3 - - python3-pip - - python3-dev - - uwsgi - - uwsgi-plugin-python3 - - python3-venv - - git - - acl + # Common tools - gettext - - libjs-bootstrap4 + - git + - ipython3 + + # Front-end dependencies - fonts-font-awesome - - texlive-latex-extra + - libjs-bootstrap4 + + # Python dependencies + - python3-babel + - python3-django + - python3-django-cas-server + - python3-django-crispy-forms + - python3-django-extensions + - python3-django-filters + - python3-django-polymorphic + - python3-djangorestframework + - python3-lockfile + - python3-phonenumbers + - python3-pil + - python3-pip + - python3-psycopg2 + - python3-venv + + # LaTeX (PDF generation) - texlive-fonts-extra - texlive-lang-french + - texlive-latex-extra + + # WSGI server + - uwsgi + - uwsgi-plugin-python3 register: pkg_result retries: 3 until: pkg_result is succeeded diff --git a/ansible/roles/2-nk20/tasks/main.yml b/ansible/roles/2-nk20/tasks/main.yml index 19dcdbbd..8a75fa89 100644 --- a/ansible/roles/2-nk20/tasks/main.yml +++ b/ansible/roles/2-nk20/tasks/main.yml @@ -31,19 +31,7 @@ - name: Setup cron jobs file: - src: /var/www/note_kfet/note.cron + src: ../note.cron dest: /etc/cron.d/note - state: link owner: root group: root - -- name: Restart cron service - systemd: - name: cron - state: restarted - -- name: Update permissions for the cron file - file: - path: /var/www/note_kfet/note.cron - owner: root - group: www-data diff --git a/ansible/roles/3-pip/tasks/main.yml b/ansible/roles/3-pip/tasks/main.yml index cbc3e902..4fd954ab 100644 --- a/ansible/roles/3-pip/tasks/main.yml +++ b/ansible/roles/3-pip/tasks/main.yml @@ -1,14 +1,8 @@ --- - name: Install PIP basic dependencies pip: - requirements: /var/www/note_kfet/requirements/base.txt - virtualenv: /var/www/note_kfet/env - virtualenv_command: /usr/bin/python3 -m venv - become_user: www-data - -- name: Install PIP production dependencies - pip: - requirements: /var/www/note_kfet/requirements/production.txt + requirements: /var/www/note_kfet/requirements.txt virtualenv: /var/www/note_kfet/env virtualenv_command: /usr/bin/python3 -m venv + virtualenv_site_packages: true become_user: www-data diff --git a/ansible/roles/4-nginx/tasks/main.yml b/ansible/roles/4-nginx/tasks/main.yml index 32fa651a..431e470b 100644 --- a/ansible/roles/4-nginx/tasks/main.yml +++ b/ansible/roles/4-nginx/tasks/main.yml @@ -1,4 +1,11 @@ --- +- name: Install NGINX + apt: + name: nginx + register: pkg_result + retries: 3 + until: pkg_result is succeeded + - name: Copy conf of Nginx template: src: "nginx_note.conf"