From 3f0208a664a3872c1d0ad131c4926004f3403606 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Wed, 15 Jul 2020 09:27:11 +0200 Subject: [PATCH] :bug: First fix Ansible installation --- ansible/base.yml | 12 +++++----- .../{apt-basic => 1-apt-basic}/tasks/main.yml | 6 ++--- ansible/roles/2-nk20/tasks/main.yml | 23 +++++++++++++++++++ .../{python-venv => 3-pip}/tasks/main.yml | 2 ++ .../roles/{nginx => 4-nginx}/tasks/main.yml | 10 ++++---- ansible/roles/nk20/tasks/main.yml | 12 ---------- 6 files changed, 40 insertions(+), 25 deletions(-) mode change 100644 => 100755 ansible/base.yml rename ansible/roles/{apt-basic => 1-apt-basic}/tasks/main.yml (81%) create mode 100644 ansible/roles/2-nk20/tasks/main.yml rename ansible/roles/{python-venv => 3-pip}/tasks/main.yml (75%) rename ansible/roles/{nginx => 4-nginx}/tasks/main.yml (62%) delete mode 100644 ansible/roles/nk20/tasks/main.yml diff --git a/ansible/base.yml b/ansible/base.yml old mode 100644 new mode 100755 index 79b9b932..a9e5e297 --- a/ansible/base.yml +++ b/ansible/base.yml @@ -1,9 +1,9 @@ -#!/usr/bin/env ansible-python +#!/usr/bin/env ansible-playbook --- -- hosts: beta-nk20 +- hosts: bde-nk20-beta.adh.crans.org roles: - - apt-basic - - nk20 - - python-venv - - nginx + - 1-apt-basic + - 2-nk20 + - 3-pip + - 4-nginx diff --git a/ansible/roles/apt-basic/tasks/main.yml b/ansible/roles/1-apt-basic/tasks/main.yml similarity index 81% rename from ansible/roles/apt-basic/tasks/main.yml rename to ansible/roles/1-apt-basic/tasks/main.yml index 03577640..7627743e 100644 --- a/ansible/roles/apt-basic/tasks/main.yml +++ b/ansible/roles/1-apt-basic/tasks/main.yml @@ -15,6 +15,6 @@ - texlive-latex-extra - texlive-fonts-extra - texlive-lang-french - register: pkg_result - retries: 3 - until: pkg_result is succedded + 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 new file mode 100644 index 00000000..8211444d --- /dev/null +++ b/ansible/roles/2-nk20/tasks/main.yml @@ -0,0 +1,23 @@ +--- +- name: Create note_kfet dir with good permissions + file: + path: /var/www/note_kfet + state: directory + owner: www-data + group: www-data + mode: u=rwx,g=rwxs,o=rx + +- name: Clone Note Kfet + git: + repo: https://gitlab.crans.org/bde/nk20.git + dest: /var/www/note_kfet + version: beta-soon + track_submodules: yes + +- name: Update permissions for note_kfet dir + file: + path: /var/www/note_kfet + state: directory + recurse: yes + owner: www-data + group: www-data diff --git a/ansible/roles/python-venv/tasks/main.yml b/ansible/roles/3-pip/tasks/main.yml similarity index 75% rename from ansible/roles/python-venv/tasks/main.yml rename to ansible/roles/3-pip/tasks/main.yml index 386fb214..10b45a76 100644 --- a/ansible/roles/python-venv/tasks/main.yml +++ b/ansible/roles/3-pip/tasks/main.yml @@ -3,8 +3,10 @@ pip: requirements: /var/www/note_kfet/requirements/base.txt virtualenv: /var/www/note_kfet/env + virtualenv_command: /usr/bin/python3 -m venv - name: Install PIP production dependencies pip: requirements: /var/www/note_kfet/requirements/production.txt virtualenv: /var/www/note_kfet/env + virtualenv_command: /usr/bin/python3 -m venv diff --git a/ansible/roles/nginx/tasks/main.yml b/ansible/roles/4-nginx/tasks/main.yml similarity index 62% rename from ansible/roles/nginx/tasks/main.yml rename to ansible/roles/4-nginx/tasks/main.yml index 08b005af..4e8a9b50 100644 --- a/ansible/roles/nginx/tasks/main.yml +++ b/ansible/roles/4-nginx/tasks/main.yml @@ -1,19 +1,21 @@ --- +- name: Copy example conf of Nginx + command: cp /var/www/note_kfet/nginx_note.conf_example /var/www/note_kfet/nginx_note.conf + - name: Update Nginx conf replace: - path: /var/www/note_kfet/nginx_note.conf.example - dest: /var/www/note_kfet/nginx_note.conf + path: /var/www/note_kfet/nginx_note.conf regexp: 'note.example.org' replace: 'bde-nk20-beta.adh.crans.org' - name: Copy conf to Nginx file: - path: /var/www/note_kfet/nginx_note.conf + src: /var/www/note_kfet/nginx_note.conf dest: /etc/nginx/sites-enabled/nginx_note.conf state: link - name: Copy conf to UWSGI file: - path: /var/www/note_kfet/uwsgi_note.ini + src: /var/www/note_kfet/uwsgi_note.ini dest: /etc/uwsgi/apps-enabled/uwsgi_note.ini state: link diff --git a/ansible/roles/nk20/tasks/main.yml b/ansible/roles/nk20/tasks/main.yml deleted file mode 100644 index cc2945df..00000000 --- a/ansible/roles/nk20/tasks/main.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: Create note_kfet dir with good permissions - file: - path: /var/www - owner: www-data - group: foo - mode: u=rw,g=rws,o=r - -- name: Clone Note Kfet - git: - repo: https://gitlab.crans.org/bde/nk20.git - dest: /var/www/note_kfet