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